apache / apache/curator

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

Open
#938 0 comments 0 reactions 0 assignees View on GitHub
bug imported-jira-issue
Dominant language
Java
Stars
3.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.