Repository navigation
feat(taskworker): Send heartbeats for running tasks - #859
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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lvthanh03
left a comment
There was a problem hiding this comment.
thanks for addressing the comment, looks good to me!


Add a new child process that is responsible for tracking heartbeat tasks. The parent starts a
heartbeat process that keeps track of all the activations that have a heartbeat set. It periodically
loops through those activations and calls the new update heartbeat endpoint on the broker.
When an activation is completed on the broker, it is removed from the tracked set of activations.
Both the parent and child keep a copy of the state of track activations, so if the child crashes the
parent can correctly restart it with all the tracked activations intact. Incoming/outgoing activations
update the state in the parent, and are synchronized to the child process using a channel.