curator icon indicating copy to clipboard operation
curator copied to clipboard

[CURATOR-418] ServiceCacheImpl.close() should be idempotent

Open jira-importer opened this issue 8 years ago • 0 comments

https://github.com/apache/curator/blob/6ca77776d3d2c71b1e541c0edd60d2c17efe9c66/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheImpl.java#L104 emits IllegalStateException if ServiceCacheImpl is already closed, that contradicts Closeable contract, it states that close() call should be idempotent: https://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html

Might be applicable to other Closeable implementations in the Curator project.

Anyway, the issue is that we have a lot of errors like this in logs:

Exception in thread "Thread-113" java.lang.IllegalStateException: Already closed or has not been started
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at org.apache.curator.x.discovery.details.ServiceCacheImpl.close(ServiceCacheImpl.java:104)
at org.apache.curator.x.discovery.details.ServiceProviderImpl.close(ServiceProviderImpl.java:78)
at com.google.common.io.Closeables.close(Closeables.java:77)
at org.apache.curator.utils.CloseableUtils.closeQuietly(CloseableUtils.java:59)
at org.apache.curator.x.discovery.details.ServiceDiscoveryImpl.close(ServiceDiscoveryImpl.java:149)
at io.druid.curator.discovery.DiscoveryModule$5.stop(DiscoveryModule.java:227)
at io.druid.java.util.common.lifecycle.Lifecycle.stop(Lifecycle.java:284)
at io.druid.java.util.common.lifecycle.Lifecycle$1.run(Lifecycle.java:310)
at java.lang.Thread.run(Thread.java:748)


Originally reported by leventov, imported from: ServiceCacheImpl.close() should be idempotent
  • assignee: randgalt
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2025-01-21

jira-importer avatar Jun 22 '17 21:06 jira-importer