Skip to content

Slot waits: an account can be booked twice while a re-ask on another account is unwritten #117

Closed

Description

@scuttletoby

From the concurrency-and-abuse review of #116 (#116 (comment)), minor.

Problem: while a thread's new slot request is granted but not yet written, the slot it already held is hidden from every count, including its account's limit. If the new request is for a different account (or none), another thread can be granted the old slot's account in the same sweep. If the new request is then cancelled before it is written, the old slot comes back and that account is booked twice. Both threads may be refused when they delegate, until one hold ends (at most reserveSeconds).

Fix idea: while the new request is pending, keep counting the old hold against its own account limit (not twice against the machine limit).

Test: the reviewer's failing test (re-ask on another account, a second thread granted the first account, the re-ask cancelled: the account must not be over its limit).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions