Skip to content

[Bug] Concurrent ZK notification cleanup throws NoSuchElementException #3753

Description

@gyang94

Search before asking

  • I searched in the issues and found nothing similar.

Fluss version

0.9.0 (latest release)

Please describe the bug 🐞

Description

In a multi-server cluster, updating dynamic configs may produce the following error after the configs have been applied successfully:

ERROR ZkNodeChangeNotificationWatcher - Error while purging obsolete notification change for path = /config/changes/config_change_0000000007
java.util.NoSuchElementException: No value present
    at java.util.Optional.get(Optional.java:143)
    at org.apache.fluss.server.authorizer.ZkNodeChangeNotificationWatcher.purgeObsoleteNotifications(ZkNodeChangeNotificationWatcher.java:142)
Image

Root cause

Each watcher reads a snapshot of all children under /config/changes and independently purges expired nodes. After one watcher deletes a node, another watcher may still have it in its children snapshot.
getStat() then returns Optional.empty(), but the result is accessed directly with Optional.get():

Stat state = zooKeeperClient.getStat(notificationNode).get();

Solution

Do empty check before get the state.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions