Skip to content

(Attempt to) Fix deadlock between consumer and heartbeat #1628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions kafka/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,7 @@ def poll(self, timeout_ms=None, future=None):

self._poll(timeout)

# called without the lock to avoid deadlock potential
# if handlers need to acquire locks
responses.extend(self._fire_pending_completed_requests())
responses.extend(self._fire_pending_completed_requests())

# If all we had was a timeout (future is None) - only do one poll
# If we do have a future, we keep looping until it is done
Expand Down
2 changes: 1 addition & 1 deletion kafka/coordinator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def _handle_join_failure(self, _):

def ensure_active_group(self):
"""Ensure that the group is active (i.e. joined and synced)"""
with self._lock:
with self._client._lock, self._lock:
if self._heartbeat_thread is None:
self._start_heartbeat_thread()

Expand Down