ArrayIndexOutOfBoundsException and NPE in regexp-Code

Benjamin Sieffert benjamin.sieffert at metrigo.de
Wed Jul 2 11:12:01 UTC 2014


Thank you, glad to hear it had already been tracked down and fixed. We're
gonna use the workaround until the release of update 20 then.


2014-07-02 13:05 GMT+02:00 Jim Laskey (Oracle) <james.laskey at oracle.com>:

> Benjamin,
>
> We've run into a few cases where Joni (regex) is not safe across threads.
>  This has been fixed in 8u20
> http://hg.openjdk.java.net/jdk8u/jdk8u-dev/nashorn/rev/9ad26ed8cc97 .
>  The workaround is to use new RegExp("...") so that the regexp is not
> shared.  If you are iterating through a loop, hoist the expression outside
> the loop.
>
> Cheers,
>
> -- Jim
>
>
>
>
>
> On Jul 2, 2014, at 6:39 AM, Benjamin Sieffert <
> benjamin.sieffert at metrigo.de> wrote:
>
> > Hello everyone,
> >
> > we are running jdk8u5 and seeing occasional errors in the
> nashorn-internal
> > regexp classes.
> > The regex in use is a very simple one that basically is just supposed to
> do
> > several string matches in a readable manner like /some
> > string|stringtotestfor|test for this string too/
> >
> > Some sample stacktraces:
> >
> > 1) ArrayIndexOutOfBoundsException: 8
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.ByteCodeMachine.opExactNIC(ByteCodeMachine.java:381):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.ByteCodeMachine.matchAt(ByteCodeMachine.java:129):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.Matcher.matchCheck(Matcher.java:272):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.Matcher.search(Matcher.java:405):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.JoniRegExp$JoniMatcher.search(JoniRegExp.java:131):1
> > in ""
> >
> >
> jdk.nashorn.internal.objects.NativeRegExp.execInner(NativeRegExp.java:559):1
> > in ""
> >
> > jdk.nashorn.internal.objects.NativeRegExp.test(NativeRegExp.java:643):1
> in
> > ""
> >
> > jdk.nashorn.internal.objects.NativeRegExp.test(NativeRegExp.java:322):1
> in
> > ""
> >
> > jdk.nashorn.internal.scripts.Script$library$2._L356(library:460):1 in ""
> >
> > 2) NPE
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.ByteCodeMachine.opExactN(ByteCodeMachine.java:361):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.ByteCodeMachine.matchAt(ByteCodeMachine.java:126):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.Matcher.matchCheck(Matcher.java:272):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.joni.Matcher.search(Matcher.java:405):1
> > in ""
> >
> >
> jdk.nashorn.internal.runtime.regexp.JoniRegExp$JoniMatcher.search(JoniRegExp.java:131):1
> > in ""
> >
> >
> jdk.nashorn.internal.objects.NativeRegExp.execInner(NativeRegExp.java:559):1
> > in ""
> >
> > jdk.nashorn.internal.objects.NativeRegExp.test(NativeRegExp.java:643):1
> in
> > ""
> >
> > jdk.nashorn.internal.objects.NativeRegExp.test(NativeRegExp.java:322):1
> in
> > ""
> >
> > jdk.nashorn.internal.scripts.Script$library$2._L356(library:460):1 in ""
> >
> > Would be nice to get some input on this. Sadly, there I don't have a
> > reliable way to reproduce this
> > right now. Script gets evaluated in a multithreaded environment, so it
> > might have something to do with that.
> >
> > Regards
> >
> > --
> > Benjamin Sieffert
> > metrigo GmbH
> > Sternstr. 106
> > 20357 Hamburg
> >
> > Geschäftsführer: Christian Müller, Tobias Schlottke, Philipp Westermeyer,
> > Martin Rieß
> > Die Gesellschaft ist eingetragen beim Registergericht Hamburg
> > Nr. HRB 120447.
>
>


-- 
Benjamin Sieffert
metrigo GmbH
Sternstr. 106
20357 Hamburg

Geschäftsführer: Christian Müller, Tobias Schlottke, Philipp Westermeyer,
Martin Rieß
Die Gesellschaft ist eingetragen beim Registergericht Hamburg
Nr. HRB 120447.


More information about the nashorn-dev mailing list