RE: java.lang.ArrayIndexOutOfBoundsException under load/stress

"Karachiwala, Aslam" <[email protected]> Mon, 25 Oct 2004 11:08:49 -0400
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <114FF55F1B0AFB4EB793CD8659035DD90A04BE@hd-cambridge.highlinedata.com>
Thanks, Daniel

I will get the new version of ORO and eliminate the invocation of
compile() by concurrent threads. Do you see any problems with making the
matcher and compiler objects local to a static method? IOW,
findPattern() would be static and InsRegExpProcessor would no longer
need to be a singleton.

--aslam=20

-----Original Message-----
From: Daniel F. Savarese [mailto:[email protected]]=20
Sent: Saturday, October 23, 2004 12:26 AM
To: ORO Users List
Subject: Re: java.lang.ArrayIndexOutOfBoundsException under load/stress=20


In message
<114FF55F1B0AFB4EB793CD8659035DD90A04BD@hd-cambridge.highlinedata.co
m>, "Karachiwala, Aslam" writes:
>I've seen a couple of mentions of this on the list but no explanation=20
>or workaround. My web app uses ORO to modify query string params of

Please try using the the latest release.  There have been one or two
fixes since 2.0.4 that could be related.  On the other hand, even though
you are compiling patterns with READ_ONLY_MASK and using a single
compiler and matcher instance per class instance, if the compiler or
matcher is accessed concurrently, you'll wind up with random errors.  In
fact, there's no point in compiling the pattern in findPattern with
READ_ONLY_MASK if its lifetime does not exceed the scope of the method.
If findPattern is accessed concurrently, then the matcher access must be
put in a critical section.  Assuming your program has multiple threads
invoking findPattern on a single object, I'd suggest dedicating a
separate InsRegExpProcessor per thread.  The general rule is that you
want to use a separate matcher per thread to avoid the potential
complexity of concurrency control and synchronization overhead.

On a second read of your email I see the exception in question is thrown
in the compile() call.  That would only happen if you're accessing it
concurrently.  The method is completely deterministic and compiling the
same pattern will always produce the same result (either it will succeed
or fail).  It will not sometimes succeed and sometimes fail.

daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]