Subject:
|
Re: posting weirdness
|
Newsgroups:
|
lugnet.admin.general
|
Date:
|
Sun, 17 Dec 2000 02:47:03 GMT
|
Viewed:
|
279 times
|
| |
| |
In lugnet.admin.general, Todd Lehman writes:
> In lugnet.admin.general, Larry Pieniazek writes:
> > has something changed to disallow lots of blank lines (ala spoiler
> > prevention)? I have tried to post something that has a lot of white space
> > several times now, and the server just times out. Another post at the same
> > time without white space goes through fine.
> No, nothing has changed in the web interface for posting since November 3.
> The good news here is that I see several HTTP processes each trying to use
> 100% of the CPU -- and collectiving using up several minutes of CPU. They
> seem to be hung. That's not good news per se, but it makes hunting down the
> problem a lot easier when the symptoms are so visible. My guess is in a
> regex with exponential backtracking time or something. I'll have to dig more
> and try some testing myself. I'll let you know when it's safe to try again.
OK, please try again now!
> > Could be me of course.
> I'm almost postive it's not you. Thanks very much for reporting this, and I
> see from the form logs exactly how many %0A's (newlines) you used and how many
> times you tried to narrow down and isolate the problem -- which I really
> appreciate, as it will make my job easier in fixing the problem.
Whew! Thank you so much for finding and reporting this!
I'm not sure yet[1] if this was a stupidly written regex on my part or bona
fide bug in perl's[2] regex engine. Either way, the post you submitted caused
the system to spend as much time as it possibly could (until the process was
killed) examining the body of the post for a certain pattern. That pattern
match went like this...
$body =~ s/(?:\n\s*)+$//;
...and its purpose is to strip the body of a post of any repeats of completely
blank lines at the very bottom (i.e, at end of the string). It doesn't match
blank lines in the middle of the string, but it does (did) get extremely
tripped up by them.
My gut says that this was not a bug in perl, but simply a case of *MASSIVE*
backtracking on certain data input due to the fact that \n is part of the \s
character class.
I rewrote the pattern match like this instead...
$body =~ s/(?:\n[ \t]*)+$//;
...and now it runs essentially instantaneously (as well it should!) on a post
with whitespace in the middle.
--Todd
[1] I'll have to consult the hip owls book on character class subtleties.
[2] Tested in 5.004_04 and 5.005_03
|
|
Message has 1 Reply: | | Re: posting weirdness
|
| (...) yah, that's what it looks like to me. Since it would match any newline, and start adding up the whitespace until it found the beginning of a new paragraph. it'll backtrack to the next blank line, try again, and fail once more.... if you have (...) (24 years ago, 17-Dec-00, to lugnet.admin.general)
|
Message is in Reply To:
| | Re: posting weirdness
|
| (...) No, nothing has changed in the web interface for posting since November 3. The good news here is that I see several HTTP processes each trying to use 100% of the CPU -- and collectiving using up several minutes of CPU. They seem to be hung. (...) (24 years ago, 17-Dec-00, to lugnet.admin.general)
|
8 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|