Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/3230#discussion_r98358866 --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/SafetyNetCloseableRegistry.java --- @@ -99,42 +120,61 @@ protected void doUnRegister( implements Closeable { private final Closeable innerCloseable; + private final SafetyNetCloseableRegistry closeableRegistry; private final String debugString; public PhantomDelegatingCloseableRef( WrappingProxyCloseable<? extends Closeable> referent, + SafetyNetCloseableRegistry closeableRegistry, ReferenceQueue<? super WrappingProxyCloseable<? extends Closeable>> q) { super(referent, q); this.innerCloseable = Preconditions.checkNotNull(WrappingProxyUtil.stripProxy(referent)); + this.closeableRegistry = Preconditions.checkNotNull(closeableRegistry); this.debugString = referent.toString(); } - public Closeable getInnerCloseable() { - return innerCloseable; - } - public String getDebugString() { return debugString; } @Override public void close() throws IOException { + synchronized (closeableRegistry.getSynchronizationLock()) { + closeableRegistry.closeableToRef.remove(innerCloseable); --- End diff -- Removal is done here now, because the reaper thread should not keep/locate right references for all registries
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---