Skip to content

lwt_pool: fix starvation bug - #1121

Merged
raphael-proust merged 2 commits into
ocsigen:masterfrom
koonwen:master
Jul 11, 2026
Merged

lwt_pool: fix starvation bug#1121
raphael-proust merged 2 commits into
ocsigen:masterfrom
koonwen:master

Conversation

@koonwen

@koonwen koonwen commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

[BUG] Pool waiters starve when in-use members fail and there are no new pool use attempts.

Lwt_pool.use has two failure paths, but only one wakes waiters:

  1. Free member fails validate → dispose + replace_disposed (wakes a waiter with a fresh member, or hands it the creation error).
  2. In-use member's operation raises → dispose only. No waiter is woken, no replacement created.

Waiters can only be woken by a release or replace_disposed. If all members are disposed via the failed-use path (2) and there are waiters because of pool oversubscription, they sleep indefinitely.

Comment thread test/core/test_lwt_pool.ml Outdated

@raphael-proust raphael-proust left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good now!

@raphael-proust
raphael-proust dismissed their stale review July 11, 2026 20:28

gh interface is stupid, i can't find a way to approve the more recent changes

@raphael-proust
raphael-proust merged commit 7cd3cc8 into ocsigen:master Jul 11, 2026
18 of 20 checks passed
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