Ivan Khanas created ZOOKEEPER-5114:
--------------------------------------
Summary: Audit logger exceptions interrupt closeSession and leave
ephemeral nodes behind
Key: ZOOKEEPER-5114
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5114
Project: ZooKeeper
Issue Type: Bug
Reporter: Ivan Khanas
An exception from a custom {{AuditLogger}} can leave a {{closeSession}}
transaction partially applied.
{{DataTree.processTxn()}} removes the session’s entry from the {{ephemerals}}
map before deleting its nodes. In {{{}deleteNodes(){}}}, each deletion is
followed by an audit write. If that write throws an unchecked exception, the
loop stops. The remaining nodes stay in the tree, although the session no
longer appears in the map, and {{lastProcessedZxid}} is not updated.
I reproduced this with two ephemeral nodes belonging to the same session and a
logger that throws {{IllegalStateException}} on its first write. After applying
{{{}closeSession{}}}, the first node was deleted, the second remained,
{{getEphemerals(sessionId)}} returned an empty set, and {{lastProcessedZxid}}
still pointed to the preceding transaction. With auditing disabled or a working
logger, both nodes were deleted and the zxid advanced.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)