You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by Damien Mascord <Da...@datalex.com.sg> on 2005/03/28 06:58:01 UTC
StackOverFlowError [Follow up]
Hi guys,
We are having a stackoverflow error very similar to the one mentioned by
Ulla Schat on Wed, 11 Feb 2004 01:26:07 -0800.
Using Ullas test program verbatim (without modifications to the regex or
input) we can replicate the StackOverFlow with 2.0.8 using the following
command line:
java -Xss350k -cp .:./jakarta-oro-2.0.8.jar TestRegexp 2> stackoverflow.txt
Running java version "1.5.0_01", on Linux (2.6.6/Fedora).
As you can see, __match() is being called recursively, and the stack
grows to enormous sizes, easily chewing up the 350k allocated stack
space, for such a small regex pattern...
The "easy" solution would be to increase the stack size, but this isn't
really possible for high volume, massive thread counts (production
environments), since it would mean less available threads, due to memory
usage.
The same problem has been encountered by:
http://mail-archives.eu.apache.org/mod_mbox/jakarta-oro-dev/200211.mbox/%3c66CB5AA0-FD3A-11D6-A110-00039394AD64@first.fhg.de%3e
Running the exact same thing through perl produces no errors, and is
very fast... [see attached perl]
Any ideas on how to implement this without growing the stack ?
Damien
---------------
#!/usr/bin/perl
$input = "{1:
this is some more text - and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more
this is some more text and some more and some more and even more at the end
-}";
#orig $pattern = "{(\\d+):(([^}](?!-}))*)";
#dan $pattern = "{(\\d+):([^}]+)(?!-)(?!})";
$pattern = "{(\\d+):(([^}](?!-}))*)";
if ($input =~ m/$pattern/s)
{
print "OK!\n---Match 1---\n$1\n---Match 2---\n$2\n---Match
3---\n$3\n";
} else {
print "NO MATCH\n";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: oro-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: oro-user-help@jakarta.apache.org