fix(deno): wake idle serve loops on demand - #398
Merged
Merged
Conversation
Reproduces the released busy-poll by observing the synchronous request queue drain path while an idle server has no work. The test fails on main and will pass once request readiness is event-driven. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep requests in the bounded native queue and preserve synchronous draining for #122, but replace MessageChannel idle polling with a module-lifetime thread-safe Deno callback carrying an opaque serve-generation token. Unref the callback so idle servers do not hold the process open, and wake shutdown paths without passing borrowed payload pointers across FFI. Update the Deno bridge architecture documentation and lifecycle comments to match the event-driven design. Closes #397 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the surrounding document formatting changed by the formatter while retaining only the architecture updates required for the event-driven Deno serve bridge. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iroh_http_try_next_requestdrain required by bug(deno):unknown handle/sendChunk failedunder concurrent load — only the Deno adapter is affected #122MessageChannelidle loop with a module-lifetimeDeno.UnsafeCallback.threadSafe()notification carrying only an opaque serve-generation tokenRegression evidence
The regression commit deterministically observes synchronous queue drains. On
main, an idle server increased from 8,773 to 36,766 polls over a 50 ms idle interval. With the fix, the count remains unchanged until Rust sends a request-ready notification.Release-build macOS/Deno 2.9.3 measurement:
main, idle node withoutserve()main, idle node withserve()serve()Test coverage
npm run cicargo test -p iroh-http-denoCloses #397