Skip to content

Fix busy-processor counter leak when the executor rejects a worker post#1029

Draft
mensfeld wants to merge 1 commit into
mainfrom
fix/b3-busy-counter-leak
Draft

Fix busy-processor counter leak when the executor rejects a worker post#1029
mensfeld wants to merge 1 commit into
mainfrom
fix/b3-busy-counter-leak

Conversation

@mensfeld

Copy link
Copy Markdown
Collaborator

Manager#assign increments @busy_processors before posting the worker Promise, but the matching decrement (processor_done) runs inside the promise body. When the executor rejects the post
(Concurrent::RejectedExecutionError) - a hard stop racing the running? check, or a saturated bounded custom launcher_executor - the body never runs and the counter leaks. With a bounded executor the leak is permanent: ready (@max_processors - busy) shrinks until dispatch stalls and the group silently stops processing.

Roll back the increment on RejectedExecutionError, decrementing directly (the message was never processed, so the FIFO message_processed callback must not run).

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cbf0827f-5b8f-432e-bb10-320d0a313bce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/b3-busy-counter-leak

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Manager#assign increments @busy_processors before posting the worker
Promise, but the matching decrement (processor_done) runs *inside* the
promise body. When the executor rejects the post
(Concurrent::RejectedExecutionError) - a hard stop racing the running?
check, or a saturated bounded custom launcher_executor - the body never
runs and the counter leaks. With a bounded executor the leak is
permanent: ready (@max_processors - busy) shrinks until dispatch stalls
and the group silently stops processing.

Roll back the increment on RejectedExecutionError, decrementing directly
(the message was never processed, so the FIFO message_processed callback
must not run).
@mensfeld mensfeld force-pushed the fix/b3-busy-counter-leak branch from 57de224 to 30d31f8 Compare June 20, 2026 18:02
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.

1 participant