Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8041998

RegExp implementation is not thread-safe

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The following script:

        var Thread = java.lang.Thread;

        function test_thread() {
          var line = 'content-type: text/html';
          while (1) {
            Thread.sleep(100);
            line.split(/: /);
          }
        }

        for (var i=0; i<5; i++) {
          new Thread(test_thread).start();
        }

        while (1) { Thread.sleep(1000); }

        Throws:

        java.lang.NullPointerException
        at jdk.nashorn.internal.runtime.regexp.joni.Regex.matcher(Regex.java:148)
        at jdk.nashorn.internal.runtime.regexp.joni.Regex.matcher(Regex.java:143)
        at jdk.nashorn.internal.runtime.regexp.JoniRegExp$JoniMatcher.<init>(JoniRegExp.java:126)
        at jdk.nashorn.internal.runtime.regexp.JoniRegExp.match(JoniRegExp.java:101)
        at jdk.nashorn.internal.objects.NativeRegExp.execSplit(NativeRegExp.java:581)
        at jdk.nashorn.internal.objects.NativeRegExp.split(NativeRegExp.java:824)
        at jdk.nashorn.internal.objects.NativeString.split(NativeString.java:878)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hannesw Hannes Wallnoefer
                Reporter:
                hannesw Hannes Wallnoefer
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: