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

Till Rohrmann commented on FLINK-18815:
---------------------------------------

Thanks for the analysis [~kezhuw]. I am not totally convinced that what you 
describe is the problem we are seeing here. The problem with your explanation 
is that {{SafetyNetCloseableRegistry.close()}} should explicitly close all 
registered closeables which are still contained in 
{{AbstractCloseableRegistry.closeableToRef}}. Hence, it should not matter 
whether the reaper thread still have some phantom references enqueued in its 
{{referenceQueue}}. Once {{close()}} is called, no further {{Closeables}} 
should be able to register at the registry.

The only way I could see this problem happening is after we have removed the 
closeable from {{closeableRegistry}} in 
{{PhantomDelegatingCloseableRef.close()}} we interrupt the 
{{innerCloseable.close()}} call 
(https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/core/fs/SafetyNetCloseableRegistry.java#L183).
 However, in the test implementation we are using {{TestStream}} as 
{{Closeable}} and the {{close()}} implementation is not blocking.

> AbstractCloseableRegistryTest.testClose unstable
> ------------------------------------------------
>
>                 Key: FLINK-18815
>                 URL: https://issues.apache.org/jira/browse/FLINK-18815
>             Project: Flink
>          Issue Type: Bug
>          Components: FileSystems, Tests
>    Affects Versions: 1.10.1, 1.12.0, 1.11.1
>            Reporter: Robert Metzger
>            Assignee: Kezhu Wang
>            Priority: Critical
>              Labels: pull-request-available, test-stability
>             Fix For: 1.10.2, 1.12.0, 1.11.2
>
>
> https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=5164&view=logs&j=0da23115-68bb-5dcd-192c-bd4c8adebde1&t=05b74a19-4ee4-5036-c46f-ada307df6cf0
> {code}
> [ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.509 
> s <<< FAILURE! - in org.apache.flink.core.fs.SafetyNetCloseableRegistryTest
> [ERROR] testClose(org.apache.flink.core.fs.SafetyNetCloseableRegistryTest)  
> Time elapsed: 1.15 s  <<< FAILURE!
> java.lang.AssertionError: expected:<0> but was:<-1>
>       at org.junit.Assert.fail(Assert.java:88)
>       at org.junit.Assert.failNotEquals(Assert.java:834)
>       at org.junit.Assert.assertEquals(Assert.java:645)
>       at org.junit.Assert.assertEquals(Assert.java:631)
>       at 
> org.apache.flink.core.fs.AbstractCloseableRegistryTest.testClose(AbstractCloseableRegistryTest.java:93)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {code}



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

Reply via email to