wavefnd / wavefnd/Wave

Prevent low-index sockets from starving Windows event_wait results

Open
#530 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted os-specific bug
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

`event_wait` polls all registered sockets, but copies ready entries starting at index zero on every call and stops when the caller output capacity is full. With two continuously writable sockets and capacity one, the first entry can be returned indefinitely while the second is never delivered. A bounded event buffer should not make later registrations unobservable.

Source evidence at the head of #520:

- [std/sys/windows/event.wave:84](https://github.com/wavefnd/Wave/blob/2ae0a91c57fd76323124c0e4dff552adbfadbe1b/std/sys/windows/event.wave#L84) — `pub fun event_wait`

Acceptance:

- [ ] Rotate the starting point or retain pending readiness so repeatedly ready earlier entries cannot starve later ones.
- [ ] Use deterministic socket fixtures with more ready registrations than result slots, and assert every token is eventually observed within a bounded number of polls.
- [ ] Cover removal/reinsertion and mixed readable/writable/error results without stale tokens.
- [ ] Preserve the existing small readiness fallback; this does not require replacing it with IOCP.

Related: #385 and #445; this is the synchronous readiness fallback, not the IOCP provider.

Audit status: identified by static source inspection; the scenarios above have not been executed during this audit. The permalink fixes the reviewed revision; this report does not claim the defect was introduced by #520.

Contributor guide

Open the contributing guide

Research direction

Start at std/sys/windows/event.wave:84 and trace pub fun event_wait through the synchronous readiness fallback. Add deterministic socket fixtures with more ready registrations than result slots, then verify bounded polling observes every token, including removal/reinsertion and mixed readable, writable, and error results without stale tokens. Preserve the existing fallback rather than replacing it with IOCP.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.