Title: Add opt-in WASIX TCP and UDP socket support by youknowdot · Pull Request #9809 · RustPython/RustPython · GitHub
Open Graph Title: Add opt-in WASIX TCP and UDP socket support by youknowdot · Pull Request #9809 · RustPython/RustPython
X Title: Add opt-in WASIX TCP and UDP socket support by youknowdot · Pull Request #9809 · RustPython/RustPython
Description: Summary Add real TCP/UDP socket operations for wasm32-wasip1 through an opt-in wasix feature, tested with Wasmer 7.5.0. Connect socket construction, bind/listen/accept/connect, send/receive, forward DNS and endpoint names to the WASIX host ABI. Support blocking, nonblocking and timeout operations with polling, byte-buffer I/O, makefile, sendfile, duplication and descriptor ownership. Fix the WebAssembly constructor's positional/keyword arguments. Remove fabricated fd 0, successful no-op socket options and invented addresses. Keep portable preview1 builds free of WASIX imports. Unsupported hosts reject socket construction with ENOTSUP. Add loopback and denied-capability tests to the WASI CI job. Native Unix/Windows socket implementation and hot paths are unchanged. Validation Current head 942a0d65d1 passed 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 a7a8fab002 is conflict-free. No source changes or repeated CI run were needed for that check. Earlier local validation records: Wasmer guest integration at 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. Networking disabled: real ENOTSUP, no fabricated success. Portable preview1 without the feature: explicit unsupported socket construction passed. Host ABI layout/unit tests: 3 passed under Wasmer; additional probes covered explicit protocols, socket options and raw descriptor ownership. WASI Clippy at 703423b4d2, with and without wasix: passed with no warnings in changed code; existing unrelated WASI warnings remain. Pre-commit hooks and actionlint passed. Zizmor has no new findings; the same four low-severity findings exist on main, and the medium-or-higher scan passes. Native workspace tests and doctests: 1,542 passed, 20 ignored, 0 failed. Separate C API tests: 149 passed, 2 ignored, 0 failed. Native workspace and separate C API strict Clippy (--all-targets -- -D warnings): passed. Native release at 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. Native loopback timing sanity check: 2,000 bidirectional 32-byte round trips, 7 samples, median 10.13 ms. No exact-main optimized binary was available, so this is not a controlled performance-regression comparison. The unchanged stdlib_socket snippet under WASIX stops at its assumption that one recv() 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_socket aborts in dns-lookup 4.0.2 while decoding a localized error (test_getaddrinfo_localized_error, UTF-8 unwrap, exit 101). The native stdlib_socket snippet reaches its NETLINK case and fails with host EPERM. Both outcomes reproduce with the previously built 38d813fba3 interpreter using this branch's same Lib. Native socket implementation files are unchanged by this PR. The 703423b4d2 follow-up changes only the WASM socket module, WASIX integration test and documentation; native gates above ran at 564694cf31. Host requirements and limits WASIX extensions are not standard WASI preview1. The feature needs a host providing wasix_32v1 and 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_TYPE reports ENOTSUP if 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.
Open Graph Description: Summary Add real TCP/UDP socket operations for wasm32-wasip1 through an opt-in wasix feature, tested with Wasmer 7.5.0. Connect socket construction, bind/listen/accept/connect, send/receive, forwa...
X Description: Summary Add real TCP/UDP socket operations for wasm32-wasip1 through an opt-in wasix feature, tested with Wasmer 7.5.0. Connect socket construction, bind/listen/accept/connect, send/receive, forwa...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9809
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c31bf435-3cda-a24a-8425-ce78aaa71a95 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B4B8:3D97C8:2E6768C:3DCA05D:6B01D7EA |
| html-safe-nonce | a5e135f565e61fd341bcfeadc5796d1c883ef10f2d6b260abdc292b2819ff133 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNEI4OjNEOTdDODoyRTY3NjhDOjNEQ0EwNUQ6NkIwMUQ3RUEiLCJ2aXNpdG9yX2lkIjoiMzI0NDQ4MTQ1MDM5MjgwMzMwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 16b6dee596853b6bd42952fa19f49a7394489159c93b6053290dba1838644213 |
| hovercard-subject-tag | pull_request:5263652291 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9809/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Add real TCP/UDP socket operations for wasm32-wasip1 through an opt-in wasix feature, tested with Wasmer 7.5.0. Connect socket construction, bind/listen/accept/connect, send/receive, forwa... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width