Skip to content

fix: Replace scheduler channel with sync.Cond to prevent deadlock#261

Merged
alecthomas merged 1 commit intomainfrom
aat/fix-scheduler-deadlock
Apr 15, 2026
Merged

fix: Replace scheduler channel with sync.Cond to prevent deadlock#261
alecthomas merged 1 commit intomainfrom
aat/fix-scheduler-deadlock

Conversation

@alecthomas
Copy link
Copy Markdown
Collaborator

Workers and Submit() callers could deadlock when the workAvailable
channel buffer (1024) filled up. All workers would block on the
deferred channel send in runJob, preventing any reader from draining
the channel. sync.Cond.Signal() never blocks, eliminating the issue.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@alecthomas alecthomas requested a review from a team as a code owner April 15, 2026 02:07
@alecthomas alecthomas requested review from inez and removed request for a team April 15, 2026 02:07
@alecthomas alecthomas enabled auto-merge (squash) April 15, 2026 02:07
@alecthomas alecthomas disabled auto-merge April 15, 2026 02:09
@alecthomas alecthomas force-pushed the aat/fix-scheduler-deadlock branch from 6fb0e18 to 9141807 Compare April 15, 2026 02:12
Copy link
Copy Markdown
Contributor

@stuartwdouglas stuartwdouglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but it looks like the tests have issues with the race detector.

@alecthomas alecthomas force-pushed the aat/fix-scheduler-deadlock branch from 9141807 to 4e16550 Compare April 15, 2026 04:55
Workers and Submit() callers could deadlock when the workAvailable
channel buffer (1024) filled up. All workers would block on the
deferred channel send in runJob, preventing any reader from draining
the channel. sync.Cond.Signal() never blocks, eliminating the issue.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alecthomas alecthomas force-pushed the aat/fix-scheduler-deadlock branch from 4e16550 to a2f3ed0 Compare April 15, 2026 05:29
@alecthomas alecthomas merged commit 4ad6165 into main Apr 15, 2026
8 checks passed
@alecthomas alecthomas deleted the aat/fix-scheduler-deadlock branch April 15, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants