curator icon indicating copy to clipboard operation
curator copied to clipboard

[CURATOR-467] Avoid logging errors after curator framework is closed.

Open jira-importer opened this issue 7 years ago • 2 comments

When the following operations are performed in rapid succession, it can lead annoying errors being logged.

  • Create curator framework
  • Create leader latch
  • Start leader latch
  • Close leader latch
  • Close curator framework

The errors happen because background processing queued by the leader latch is still in flight when the curator framework is closed. When these background ops try to access the closed curator framework the following exception happens. It would be nice if the messages were logged at debug after close.

2018-06-01 17:35:52,095 [imps.CuratorFrameworkImpl] ERROR: Background exception was not retry-able or retry gave up
java.lang.IllegalStateException: instance must be started before calling this method
	at org.apache.curator.shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:176)
	at org.apache.curator.framework.imps.CuratorFrameworkImpl.delete(CuratorFrameworkImpl.java:359)
	at org.apache.curator.framework.recipes.leader.LeaderLatch.setNode(LeaderLatch.java:666)
	at org.apache.curator.framework.recipes.leader.LeaderLatch.access$300(LeaderLatch.java:64)
	at org.apache.curator.framework.recipes.leader.LeaderLatch$4.processResult(LeaderLatch.java:492)
	at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(CuratorFrameworkImpl.java:749)
	at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:522)
	at org.apache.curator.framework.imps.CreateBuilderImpl.sendBackgroundResponse(CreateBuilderImpl.java:584)
	at org.apache.curator.framework.imps.CreateBuilderImpl.access$900(CreateBuilderImpl.java:44)
	at org.apache.curator.framework.imps.CreateBuilderImpl$6.processResult(CreateBuilderImpl.java:534)
	at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:607)
	at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)

Originally reported by kturner, imported from: Avoid logging errors after curator framework is closed.
  • assignee: randgalt
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2025-01-21

jira-importer avatar Jun 01 '18 21:06 jira-importer

kturner:

The error message instance must be started before calling this method in the exception above is misleading. It implies that the instance was not yet started, however it was started and then stopped. I opened CURATOR-448 about this.

jira-importer avatar Jun 01 '18 21:06 jira-importer

[Originally related to: CURATOR-469]

jira-importer avatar Jan 21 '25 13:01 jira-importer