Repository navigation
Add opt-in WASIX TCP and UDP socket support - #9809
youknowdot wants to merge 6 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: Pre-merge checks:
|
Merging this PR will not alter performance
Comparing Footnotes
|
Replace the WebAssembly socket placeholder with a real Wasmer WASIX backend behind an explicit wasix feature. Connect TCP, UDP, forward DNS, polling, timeout handling and descriptor ownership to Python socket APIs, and reject unavailable capabilities rather than fabricating successful operations. Add loopback and capability-denial integration tests while preserving the portable preview1 build and native socket paths. AI assistance: OpenAI Codex implemented the backend, integration tests and documentation and ran the recorded validation. The model version was not exposed by the runtime. Assisted-by: Codex:unreported
Use the VM unlocked buffer helper for send, sendall and sendto so blocking host calls and signal callbacks never retain an exporter payload lock. Cover bytearray and memoryview sends in the WASIX integration suite. AI assistance: OpenAI Codex reviewed buffer lifetimes, applied the fix and ran validation. Assisted-by: Codex:unreported
Check the shared deadline before every I/O attempt, including retries that continue making progress, and exercise sendall with a full peer receive window. AI assistance: OpenAI Codex reviewed deadline handling and added the fix and regression coverage. Assisted-by: Codex:unreported
Queue a byte before starting the timed send so the subsequent receive does not assume that a timed-out operation sent a prefix. AI assistance: OpenAI Codex reviewed and adjusted the new test. Assisted-by: Codex:unreported
Expose unsupported reverse lookup as an OS error so socket.getfqdn can use its documented explicit-name fallback. Exercise a real HTTPServer request through WASI select and document the wildcard-hostname limit. AI assistance: implemented and validated with OpenAI Codex; the runtime did not expose the model version. Assisted-by: Codex:unreported
Use CPython's flags-based signature fallback for module-level close and dup, matching the native socket backend. Keep descriptor conversion and networking behavior unchanged. The existing builtin_signature snippet covers both functions. AI assistance: implemented and validated with OpenAI Codex; the runtime did not expose the model version. Assisted-by: Codex:unreported
d7fd9ae to
942a0d6
Compare
Summary
Add real TCP/UDP socket operations for
wasm32-wasip1through an opt-inwasixfeature, tested with Wasmer 7.5.0.makefile,sendfile, duplication and descriptor ownership.ENOTSUP.Validation
Current head
942a0d65d1passed hosted CI, including Linux/macOS/Windows snippets, Rust tests, Clippy, Miri, WASI and cross-target checks. All 26 reported checks succeeded; the optional base/head/CPython comparison was skipped. The WASI job actually built the opt-in backend and passed all 22 WASIX socket tests, denied-networking checks and the portable preview1 unsupported-capability check.A November 17 merge check against main
a7a8fab002is conflict-free. No source changes or repeated CI run were needed for that check.Earlier local validation records:
703423b4d2: 22 tests passed, including IPv4/IPv6 TCP, UDP, DNS, timeouts, partial reads, file-like I/O, an actual HTTPServer request/response, and descriptor lifetime/error cases.ENOTSUP, no fabricated success.703423b4d2, with and withoutwasix: passed with no warnings in changed code; existing unrelated WASI warnings remain.--all-targets -- -D warnings): passed.564694cf31: 58 selected socket regressions ran: 56 passed and 2 existing skips, covering TCP/UDP, socket pairs, nonblocking I/O, file objects, timeouts, buffers and server helpers.The unchanged
stdlib_socketsnippet under WASIX stops at its assumption that onerecv()returns an entire sent file. WASIX can return a valid short read. The new integration test checks the complete 32 KiB transfer with a receive loop; no existing assertion or skip was changed.Native full-suite limits were also recorded rather than hidden:
-m test test_socketaborts indns-lookup4.0.2 while decoding a localized error (test_getaddrinfo_localized_error, UTF-8unwrap, exit 101).stdlib_socketsnippet reaches its NETLINK case and fails with hostEPERM.38d813fba3interpreter using this branch's sameLib. Native socket implementation files are unchanged by this PR. The703423b4d2follow-up changes only the WASM socket module, WASIX integration test and documentation; native gates above ran at564694cf31.Host requirements and limits
WASIX extensions are not standard WASI preview1. The feature needs a host providing
wasix_32v1and networking permission, such as Wasmer's--net. It is opt-in so ordinary preview1 artifacts remain portable.This does not add Unix/raw sockets, ancillary messages, multicast configuration, reverse DNS, system hostname/service lookup, IPv6 scope IDs or TLS. Unsupported flags/options fail explicitly. Wasmer cannot identify the type of rewrapped TCP listeners or bound UDP sockets; these require explicit constructor metadata, and
SO_TYPEreportsENOTSUPif the host cannot establish the actual type.Build/run instructions and capability details: wasm/WASIX.md.
AI assistance: OpenAI Codex implemented the backend, tests and documentation and ran the listed validation. The runtime did not expose its model version.