Repository navigation
Key weak collections by net sockets and servers, and carry the socket in undici client diagnostics - #1742
Merged
Conversation
… in undici client diagnostics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Key weak collections by net sockets and servers, and carry the socket in undici client diagnostics
Summary
net.Socketandnet.Servervalues can now key weak collections by identity. Before, they failed at run time with "Weak collection keys of this native reference type have no weak lifetime lowering". Releasing a socket or server notifies the weak-dispose hook, so its entries go away with it. The hook is set only in programs that create a weak collection, so other net programs pay one predictable branch per release.diagnostics_channelmessage, now converts to a checked-dynamic value, with the handle boxed by reference. A bare handle already converted this way. Before, publishing{ socket }was refused at compile time.socketonundici:client:connectedandundici:client:sendHeaders. It is the same socket the connector returned. It also publishesconnectoronbeforeConnect,connectedandconnectError, matching undici 5 and 7. As in undici,connectErrorcarries no socket.Evidence
Each program runs under Node and as a native binary, and the outputs must match.
6620-weak-keys-net-socketscovers:delete;undici5andundici7subscribe to the client channels and key aWeakMap<Socket, …>by each message's socket. Both under Node and natively, 12 messages carry the socket the wrapped connector returned and none carries another.Zero cost
Zero-cost gate against the base (3,498 programs: bench, self and the whole corpus):
fs-extra-package. That program compiles to identical IR, LLVM and executable when built directly from both trees, so the flag was build nondeterminism.scr_cyc_thread.🤖 Generated with Claude Code