Skip to content

ZOOKEEPER-5011: Guard FileTxnSnapLog usage after close#2346

Open
seekskyworld wants to merge 1 commit intoapache:masterfrom
seekskyworld:fix/5011-filetxnsnaplog-closed
Open

ZOOKEEPER-5011: Guard FileTxnSnapLog usage after close#2346
seekskyworld wants to merge 1 commit intoapache:masterfrom
seekskyworld:fix/5011-filetxnsnaplog-closed

Conversation

@seekskyworld
Copy link
Contributor

@seekskyworld seekskyworld commented Jan 14, 2026

Issue: https://issues.apache.org/jira/browse/ZOOKEEPER-5011

Summary:

  • add a closed-state guard so stale references throw an IllegalStateException instead of NPEs
  • keep close idempotent and avoid marking the instance closed during truncateLog reopen
  • add coverage for save-after-close and idempotent close

Motivation:

  • improve diagnostics when stale ZooKeeperServer references hit FileTxnSnapLog after shutdown

Validation:

  • maven3\current\bin\mvn.cmd -pl zookeeper-server -Dtest=FileTxnSnapLogTest test

@seekskyworld seekskyworld force-pushed the fix/5011-filetxnsnaplog-closed branch from c83704c to ee9c131 Compare January 16, 2026 15:44
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
@seekskyworld seekskyworld force-pushed the fix/5011-filetxnsnaplog-closed branch from ee9c131 to d02940f Compare January 21, 2026 02:20
@seekskyworld seekskyworld changed the base branch from branch-3.9 to master January 21, 2026 02:20
@maoling
Copy link
Member

maoling commented Mar 2, 2026

To reproduce:

  1. Application code obtains a reference to ZooKeeperServer (e.g., server = factory.getZooKeeperServer())
  2. ...................................................................................................

Are you using an embedded ZooKeeperServer for in-JVM testing? If so, that might be why you're seeing this. This issue is typically not reproducible in a real-world cluster deployment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants