Roman Leventov created CURATOR-418:
--------------------------------------

             Summary: ServiceCacheImpl.close() should be idempotent
                 Key: CURATOR-418
                 URL: https://issues.apache.org/jira/browse/CURATOR-418
             Project: Apache Curator
          Issue Type: Bug
            Reporter: Roman Leventov
            Assignee: Jordan Zimmerman


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)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to