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

Streams.concat can hang when concat too many stream

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2 P2
    • None
    • 1.8
    • core-libs

      below snippet hangs(or just timeout) when tests
              List<Integer> empty = new ArrayList<>();
              int selected = 3;
              Stream<Integer> sToBeConcated = empty.stream();
              for(int i = 0; i < 32; i++){
                  final int i1 = i;
                  sToBeConcated = Streams.concat(sToBeConcated, Streams.generateInt(() -> i1 + 1).limit(selected == 3 ? i + 1 : 1 << 6).boxed());
              }
              System.out.println(sToBeConcated.toArray().length);

      This caused below lambda tests failed
      java/util/stream/Stream/IntStreamTest.java

      Test log shows
      java.lang.NullPointerException
      at com.sun.javatest.regtest.TestNGReporter.getMatcher(TestNGReporter.java:97)
      at com.sun.javatest.regtest.TestNGReporter.add(TestNGReporter.java:80)
      at com.sun.javatest.regtest.TestNGAction.endAction(TestNGAction.java:127)
      at com.sun.javatest.regtest.MainAction.run(MainAction.java:252)
      at com.sun.javatest.regtest.RegressionScript.run(RegressionScript.java:146)
      at com.sun.javatest.Script.run(Script.java:228)
      at com.sun.javatest.DefaultTestRunner.runTest(DefaultTestRunner.java:174)
      at com.sun.javatest.DefaultTestRunner.access$100(DefaultTestRunner.java:43)
      at com.sun.javatest.DefaultTestRunner$1.run(DefaultTestRunner.java:66)
      Which is because hanging cause timeout, and no testng report is available

            psandoz Paul Sandoz
            tyan Tristan Yan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: