You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2018/08/30 13:09:00 UTC

[jira] [Commented] (CALCITE-2512) StreamTest#testStreamCancel fails in a flaky way

    [ https://issues.apache.org/jira/browse/CALCITE-2512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597428#comment-16597428 ] 

Vladimir Sitnikov commented on CALCITE-2512:
--------------------------------------------

{quote}May be it makes sense to have items as final{quote}
It won't help.

The problem is {{ArrayList$Itr}} iterator is not thread-safe, and {{ROW_GENERATOR}} is used from multiple concurrent threads.

It makes sense to rework Function0 -> Supplier and rework ROW_GENERATOR to be per-table.



> StreamTest#testStreamCancel fails in a flaky way
> ------------------------------------------------
>
>                 Key: CALCITE-2512
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2512
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Sergey Nuyanzin
>            Assignee: Julian Hyde
>            Priority: Major
>
> It fails only once while local build {{mvn clean install}}
> the trace is below
> it leads to the code
> {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};
>         }
>       };
> {code}
> 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}}
> {noformat}
> [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)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)