Skip to content

Change levels for some heartbeat thread logging #1456

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 2 commits into from
Mar 23, 2018
Merged
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
12 changes: 7 additions & 5 deletions kafka/coordinator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,10 @@ def close(self):

def run(self):
try:
log.debug('Heartbeat thread started')
while not self.closed:
self._run_once()

log.debug('Heartbeat thread closed')

except ReferenceError:
log.debug('Heartbeat thread closed due to coordinator gc')

Expand All @@ -923,6 +922,9 @@ def run(self):
self.coordinator.group_id, e)
self.failed = e

finally:
log.debug('Heartbeat thread closed')

def _run_once(self):
with self.coordinator._lock:
if not self.enabled:
Expand Down Expand Up @@ -952,20 +954,20 @@ def _run_once(self):
# the session timeout has expired without seeing a
# successful heartbeat, so we should probably make sure
# the coordinator is still healthy.
log.debug('Heartbeat session expired, marking coordinator dead')
log.warning('Heartbeat session expired, marking coordinator dead')
self.coordinator.coordinator_dead('Heartbeat session expired')

elif self.coordinator.heartbeat.poll_timeout_expired():
# the poll timeout has expired, which means that the
# foreground thread has stalled in between calls to
# poll(), so we explicitly leave the group.
log.debug('Heartbeat poll expired, leaving group')
log.warning('Heartbeat poll expired, leaving group')
self.coordinator.maybe_leave_group()

elif not self.coordinator.heartbeat.should_heartbeat():
# poll again after waiting for the retry backoff in case
# the heartbeat failed or the coordinator disconnected
log.debug('Not ready to heartbeat, waiting')
log.log(0, 'Not ready to heartbeat, waiting')
self.coordinator._lock.wait(self.coordinator.config['retry_backoff_ms'] / 1000)

else:
Expand Down