wavefnd / wavefnd/Wave

Reclaim inactive async descriptor watch groups during long-running workloads

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

Description

`_watch_for` allocates a linked WatchGroup for each new descriptor value. `_refresh_watch` calls it even when there are no remaining interested waiters, including the close path. Inactive groups remain in `_watches` until global shutdown. A long-running service that sees many distinct handle values retains records and lengthens lookup scans even when its number of live connections stays small.

Source evidence at the head of #520:

- [std/task.wave:37](https://github.com/wavefnd/Wave/blob/2ae0a91c57fd76323124c0e4dff552adbfadbe1b/std/task.wave#L37) — `fun _watch_for`
- [std/task.wave:48](https://github.com/wavefnd/Wave/blob/2ae0a91c57fd76323124c0e4dff552adbfadbe1b/std/task.wave#L48) — `fun _refresh_watch`
- [std/task.wave:371](https://github.com/wavefnd/Wave/blob/2ae0a91c57fd76323124c0e4dff552adbfadbe1b/std/task.wave#L371) — `export(c, "__wave_task_close_fd")`

Acceptance:

- [ ] Avoid allocating a group when there is no native watch or logical interest to maintain.
- [ ] Reclaim or recycle groups once no waiter, active watch or pending cancellation acknowledgement refers to them.
- [ ] Add bounded churn coverage demonstrating stable registry storage for a bounded live connection set.
- [ ] Retain generation/token protection against delayed readiness and descriptor reuse.

Related: #444 and #445. This is registry storage reclamation, separate from buffer ownership and task scheduling.

Audit status: identified by static source inspection; the scenarios above have not been executed during this audit. This follows up the implementation introduced in draft PR #520.

Contributor guide

Open the contributing guide

Research direction

Start with std/task.wave functions _watch_for and _refresh_watch, then inspect the close path at the __wave_task_close_fd export and the implementation introduced in draft PR #520. Exercise bounded descriptor churn for a bounded live connection set, and verify that groups are reclaimed or recycled only after no waiter, active watch, or pending cancellation acknowledgement remains while delayed readiness and descriptor reuse stay protected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.