diff --git a/kafka/coordinator/base.py b/kafka/coordinator/base.py index e71984108..f2eaefc6c 100644 --- a/kafka/coordinator/base.py +++ b/kafka/coordinator/base.py @@ -990,6 +990,11 @@ def _run_once(self): # foreground thread has stalled in between calls to # poll(), so we explicitly leave the group. log.warning('Heartbeat poll expired, leaving group') + ### XXX + # maybe_leave_group acquires client + coordinator lock; + # if we hold coordinator lock before calling, we risk deadlock + # release() is safe here because this is the last code in the current context + self.coordinator._lock.release() self.coordinator.maybe_leave_group() elif not self.coordinator.heartbeat.should_heartbeat():