Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2512

StreamTest#testStreamCancel fails in a flaky way

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.18.0
    • Component/s: None
    • Labels:
      None

      Description

      It fails only once while local build mvn clean install
      the trace is below
      it leads to the code

        public static final Function0<Object[]> ROW_GENERATOR =
            new Function0<Object[]>() {
              private int counter = 0;
              private Iterator<String> items =
                  Iterables.cycle("paint", "paper", "brush").iterator();
      
              @Override public Object[] apply() {
                return new Object[]{System.currentTimeMillis(), counter++, items.next(), 10};
              }
            };
      

      Unfortunately could not reproduce it again. The only thing that I have in mind: could it happen that items was not initialized before items.next() call in apply(). May be it makes sense to have items as final

      [INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 21.694 s - in org.apache.calcite.test.CoreQuidemTest
      [INFO] Running org.apache.calcite.test.StreamTest
      java.util.NoSuchElementException
              at java.util.ArrayList$Itr.next(ArrayList.java:862)
              at com.google.common.collect.Iterators$4.next(Iterators.java:422)
              at org.apache.calcite.test.StreamTest$1.apply(StreamTest.java:460)
              at org.apache.calcite.test.StreamTest$1.apply(StreamTest.java:454)
              at org.apache.calcite.test.StreamTest$InfiniteOrdersTable$1.next(StreamTest.java:476)
              at org.apache.calcite.test.StreamTest$InfiniteOrdersTable$1.next(StreamTest.java:470)
              at org.apache.calcite.linq4j.Linq4j$IterableEnumerator.moveNext(Linq4j.java:463)
              at org.apache.calcite.linq4j.EnumerableDefaults$11$1.moveNext(EnumerableDefaults.java:1875)
              at org.apache.calcite.linq4j.EnumerableDefaults$11$1.moveNext(EnumerableDefaults.java:1875)
              at org.apache.calcite.linq4j.TransformedEnumerator.moveNext(TransformedEnumerator.java:35)
              at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:685)
              at org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
              at org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:217)
              at org.apache.calcite.test.StreamTest.lambda$testStreamCancel$1(StreamTest.java:251)
              at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:552)
              at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1328)
              at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1305)
              at org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
              at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
              at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
              at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.lang.Thread.run(Thread.java:748)
      [ERROR] Tests run: 9, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 0.33 s <<< FAILURE! - in org.apache.calcite.test.StreamTest
      [ERROR] testStreamCancel(org.apache.calcite.test.StreamTest)  Time elapsed: 0.14 s  <<< ERROR!
      java.lang.RuntimeException: exception while executing [select stream * from orders]
              at org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
      Caused by: java.util.NoSuchElementException
              at org.apache.calcite.test.StreamTest.lambda$testStreamCancel$1(StreamTest.java:251)
              at org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
      

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              Sergey Nuyanzin Sergey Nuyanzin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: