Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| """Renew the heartbeat of every tracked activation once per interval.""" | ||
| # The parent owns shutdown and tells us through shutdown_event. | ||
| signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
| signal.signal(signal.SIGTERM, signal.SIG_IGN) |
There was a problem hiding this comment.
Heartbeat process ignores terminate signals
Medium Severity
The heartbeat child ignores SIGTERM, but shutdown and multiprocessing daemon cleanup both use terminate() (SIGTERM). That fallback is a no-op, so a child stuck in import_app or a gRPC call is not killed. Python then join()s that daemon on interpreter exit, which can hang worker shutdown until the child happens to finish.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit afcfb0a. Configure here.
…on test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
b7fa36a adds pull mode (heartbeats go to the broker host each task came from), starts the heartbeat process when the worker starts, and adds Manual run of the real heartbeat process (spawn, examples app, pull broker, 2s heartbeat): |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b7fa36a. Configure here.
| self.worker_pool.start_metrics_thread() | ||
| self.worker_pool.start_result_thread() | ||
| self.worker_pool.start_spawn_children_thread() | ||
| self._heartbeats.start() |
There was a problem hiding this comment.
Pull worker heartbeats start too late
High Severity
TaskWorker.start kicks off the heartbeat process and then immediately fetches work. That process still has to import_app before it can renew anything, and the parent already has the app loaded so GetTask can succeed in the meantime. The broker starts the heartbeat clock at claim time, so with the default spawn context a slow import can miss the 10s minimum and reset tasks that are still running.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit b7fa36a. Configure here.
| "taskworker.worker.heartbeat.not_found", value=len(not_found), tags=tags | ||
| ) | ||
|
|
||
| shutdown_event.wait(HEARTBEAT_INTERVAL_SEC) |
There was a problem hiding this comment.
Host heartbeats run one after another
Medium Severity
Pull-mode heartbeats send one host at a time, and each RPC can block for HEARTBEAT_RPC_TIMEOUT_SEC (5s). A hung broker delays renewals for every other host in the same loop. Two timeouts already exceed the 10s minimum heartbeat, so healthy brokers can miss deadlines and retry tasks that are still running.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b7fa36a. Configure here.


STREAM-2033