wasix: enable SO_REUSEPORT in uv__sock_reuseport#9
Open
Arshia001 wants to merge 1 commit into
Open
Conversation
uv__sock_reuseport only whitelisted Linux/DragonFly/AIX/Solaris, so uv_tcp_bind/uv_udp_bind with UV_[TCP/UDP]_REUSEPORT failed UV_ENOTSUP under WASIX before the runtime was ever consulted. The full path below works: wasix-libc maps setsockopt(SO_REUSEPORT) to sock_set_opt_flag and wasmer applies SO_REUSEPORT to the underlying host socket before bind, so the load-balancing semantics are the host kernel's (Linux in practice). Verified with an EdgeJS guest on wasmer 7.2.0-rc.1: two listeners in one process bind the same port; a listener without the flag still fails EADDRINUSE; two forked guest processes listening on the same port split 40 connections 18/22; Node's test-dgram-reuseport.js passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Stacked on #8.
uv__sock_reuseportonly whitelisted Linux/DragonFly/AIX/Solaris, souv_tcp_bind/uv_udp_bindwithUV_[TCP/UDP]_REUSEPORTfailedUV_ENOTSUPunder WASIX before the runtime was ever consulted. The full path below the gate works: wasix-libc mapssetsockopt(SO_REUSEPORT)tosock_set_opt_flag, and wasmer appliesSO_REUSEPORTto the underlying host socket before bind — so the load-balancing semantics are the host kernel's (Linux in practice).Verified with an EdgeJS guest on wasmer 7.2.0-rc.1:
reusePortlisteners in one process bind the same portEADDRINUSEtest-dgram-reuseport.jspasses (it previously skipped on ENOTSUP)This is the enabling primitive for a reuseport-based cluster scheduling strategy on WASIX (workers bind the shared port themselves instead of receiving handles via SCM_RIGHTS).
🤖 Generated with Claude Code