fix: Don't block heartbeat when all slots acquired#26
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents pull-based executors (PullStaged) from starving scheduler heartbeats when all task slots are occupied by ensuring poll_work is still called periodically even if no semaphore permits are available.
Changes:
- Add a bounded wait (
SLOT_WAIT_TIMEOUT) around acquiring task slots so the loop can still callpoll_workfor heartbeat updates. - Refactor the polling loop into a helper (
poll_loop_with_slots) to support injecting a semaphore (used by tests). - Add a regression test that holds all task-slot permits and asserts
poll_workis still called.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Jeadie
reviewed
Apr 14, 2026
Jeadie
approved these changes
Apr 14, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lukekim
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When all slots are acquired, the work loop awaits forever until a slot becomes free. If the current tasks take longer than the configured heartbeat interval, the scheduler will consider the executor dead.
This is only applicable for
PullStagedtask mode, asPushStagedhas a separate heartbeater loop.To fix this for
PullStaged, add a short-circuit timeout if we spend too long waiting for a free slot. This ensures the executor connects to the scheduler at least every 15 seconds.