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

C-client crashes when removing watcher asynchronously in "local" mode

    XMLWordPrintableJSON

    Details

      Description

      The C-client library will crash when invoking the asynchronous zoo_aremove_watchers() API function with the 'local' argument set to 1.

      The reason is: if the local argument is 1/true, then the code does 'notify_sync_completion((struct sync_completion *)data);' But casting the 'data' variable to a sync_completion struct pointer is bogus/invalid, and when it's later handles as that struct pointer it's accessing invalid memory.

      As a side note: it will work ok when called synchronously through zoo_remove_watchers(), because that function creates a sync_completion struct and passes it to the asynch zoo_aremove_watchers(), but it will not work ok when the asynch function is used directly for the reason stated perviously.

      Another side note: the docs state that setting the 'local' flag makes the C-client remove the watcher "even if there is no server connection" - but really it makes the C-client remove the watcher without notifying the server at all, even if the connection to a server is up. (well... that's what it would do if it didn't just crash instead

        Attachments

        1. ZOOKEEPER-2320.patch
          42 kB
          Abraham Fine
        2. ZOOKEEPER-2320.patch
          12 kB
          Abraham Fine

          Issue Links

            Activity

              People

              • Assignee:
                abrahamfine Abraham Fine
                Reporter:
                Hadriel Hadriel Kaplan
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m