Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-890

C client invokes watcher callbacks multiple times

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Not A Problem
    • Affects Version/s: 3.3.1
    • Fix Version/s: None
    • Component/s: c client
    • Labels:
      None
    • Environment:

      Mac OS X 10.6.5

      Description

      Code using the C client assumes that watcher callbacks are called exactly once. If the watcher is called more than once, the process will likely overwrite freed memory and/or crash.

      collect_session_watchers (zk_hashtable.c) gathers watchers from active_node_watchers, active_exist_watchers, and active_child_watchers without removing them. This results in watchers being invoked more than once.

      Test code is attached that reproduces the bug, along with a proposed patch.

        Attachments

        1. ZOOKEEPER-890.patch
          0.6 kB
          Austin Bennett
        2. watcher_twice.c
          1 kB
          Austin Bennett

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                austin Austin Bennett
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: