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

Kezhu Wang commented on FLINK-19427:
------------------------------------

I could image the execution steps for this failure:

1. After {{fetcher.runOnce()}}, the queue is available for pop.
 2. Then {{QueueDrainerThread.go}} pop the last element from the queue and move 
the queue to un-available.
 3. {{assertTrue(queue.getAvailabilityFuture().isDone())}} fails.

The assertion in {{SplitFetcherTest.testNotifiesWhenGoingIdleConcurrent}} is 
similar to {{SourceReaderBase.finishedOrAvailableLater}}, they are all some 
kind of end-of-input checking. {{FutureCompletingBlockingQueue}} has no builtin 
end-of-input checking, {{SourceReaderBase}} uses external knowledge to check 
end-of-input. After reaching end-of-input, 
{{SourceReaderBase.elementsQueue.getAvailabilityFuture().isDone()}} is 
indeterministic. It could be {{false}} due to last poll, or {{true}} due to no 
atomic concurrent {{SplitFetcher.checkAndSetIdle()}}.

I think we can pass this test by run {{SplitFetcher.runOnce}} in separate 
thread and merge {{QueueDrainerThread}} to main testing method, this is 
actually the way {{SourceReaderBase}} taken. This way, after 
{{SplitFetcher.runOnce}} joined, we can safely assert {{SplitFetcher.isIdle()}} 
and {{FutureCompletingBlockingQueue.getAvailabilityFuture().isDone()}}. But 
then, this test looks almost same to its no concurrent counterpart.

Seems that we are testing wrong assumption, may be we can just delete this test 
?

[~roman_khachatryan] [~dian.fu] [~sewen] [~becket_qin] Any thoughts ?

> SplitFetcherTest.testNotifiesWhenGoingIdleConcurrent is instable
> ----------------------------------------------------------------
>
>                 Key: FLINK-19427
>                 URL: https://issues.apache.org/jira/browse/FLINK-19427
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Common
>    Affects Versions: 1.12.0
>            Reporter: Dian Fu
>            Priority: Major
>              Labels: test-stability
>
> https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=6983&view=logs&j=8fd975ef-f478-511d-4997-6f15fe8a1fd3&t=ac0fa443-5d45-5a6b-3597-0310ecc1d2ab
> {code}
> 2020-09-26T21:27:46.6223579Z [ERROR] 
> testNotifiesWhenGoingIdleConcurrent(org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherTest)
>   Time elapsed: 0.602 s  <<< FAILURE!
> 2020-09-26T21:27:46.6224448Z java.lang.AssertionError
> 2020-09-26T21:27:46.6224804Z  at org.junit.Assert.fail(Assert.java:86)
> 2020-09-26T21:27:46.6225136Z  at org.junit.Assert.assertTrue(Assert.java:41)
> 2020-09-26T21:27:46.6225498Z  at org.junit.Assert.assertTrue(Assert.java:52)
> 2020-09-26T21:27:46.6225984Z  at 
> org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherTest.testNotifiesWhenGoingIdleConcurrent(SplitFetcherTest.java:129)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to