java.lang.ArrayIndexOutOfBoundsException under load/stress

"Karachiwala, Aslam" <[email protected]> Fri, 22 Oct 2004 14:52:18 -0400
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <114FF55F1B0AFB4EB793CD8659035DD90A04BC@hd-cambridge.highlinedata.com>
- ORO 2.0.4
- Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_05-b04, mixed mode)
- Solaris 7

I've seen a couple of mentions of this on the list but no explanation or
workaround. My web app uses ORO to modify query string params of
dynamically generated URLs. I do this using a Singleton called
InsRegExpProcessor, which contains a PatternCompiler & a PatternMatcher
as private, static instance vars...

public class InsRegExpProcessor extends InsBase
{
	private static InsRegExpProcessor _Instance =3D null;

	protected PatternCompiler _patternCompiler;
	protected PatternMatcher _patternMatcher;

	private InsRegExpProcessor()
	{
		super();
		_patternCompiler =3D new Perl5Compiler();
		_patternMatcher =3D new Perl5Matcher();
	}

	public static InsRegExpProcessor getInstance()
	{
		if (null =3D=3D _Instance)
		{
			_Instance =3D new InsRegExpProcessor();
		}

		return _Instance;
	}

	...

	public boolean findPattern( String inputString, String
patternString )
		throws InsException
	{
		...

		Pattern pattern =3D _patternCompiler.compile(
patternString,
=09
Perl5Compiler.READ_ONLY_MASK );

		...
	}
=09
	...
}

This is invoked as follows:

InsRegExpProcessor regExpProcessor =3D InsRegExpProcessor.getInstance();
if (!regExpProcessor.findPattern( this.elemHref, PATTERN_QRYSTR ))
{
	...
}

The exception seems to be thrown in the _patternCompiler.compile() call
in findPattern(), whose args would be:
	inputString: "customTable.go?cmd=3Ddisplay"
	patternString [PATTERN_QRYSTR]: "(&?\w*=3D\S*)"

Note that the exception doesn't occur consistently, I see it when
load/stress testing the app.

Any ideas?

--aslam