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

Deadlock on close w/ zkpython / c client

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.0
    • Fix Version/s: 3.3.1, 3.4.0
    • Component/s: contrib-bindings
    • Labels:
      None
    • Environment:

      ubuntu 10.04, zookeeper 3.3.0 and trunk

    • Hadoop Flags:
      Reviewed

      Description

      deadlocks occur if we attempt to close a handle while there are any outstanding async requests (aget, acreate, etc). Normally on close both the io thread terminates and the completion thread are terminated and joined, however w\ith outstanding async requests, the completion thread won't be in a joinable state, and we effectively hang when the main thread does the join.

      afaics ideal behavior would be on close of a handle, to effectively clear out any remaining callbacks and let the completion thread terminate.

      i've tried adding some bookkeeping to within a python client to guard against closing while there is an outstanding async completion request, but its an imperfect solution since even after the python callback is executed there is still a window for deadlock before the completion thread finishes the callback.

      a simple example to reproduce the deadlock is attached.

        Attachments

        1. deadlock.py
          0.4 kB
          Kapil Thangavelu
        2. stack-trace-deadlock.txt
          0.7 kB
          Kapil Thangavelu
        3. deadlock_v2.py
          0.4 kB
          Kapil Thangavelu
        4. ZOOKEEPER-763.patch
          3 kB
          Henry Robinson
        5. ZOOKEEPER-763.patch
          3 kB
          Henry Robinson

          Activity

            People

            • Assignee:
              henryr Henry Robinson
              Reporter:
              kapilt Kapil Thangavelu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: