wasix: reject IPC descriptor passing up front with ENOSYS - #14
Open
Arshia001 wants to merge 1 commit into
Open
Conversation
WASI has no msghdr/SCM_RIGHTS, so uv__try_write() cannot attach a descriptor to an IPC write and refuses it. That refusal happens inside the queued write, and its status reaches the caller only as a write completion. Node's IPC channel discards that status -- it installs `req.oncomplete = () => callback(null)` -- so a `child.send(msg, handle)` reports success while the message is dropped. Neither peer learns anything: the sender believes it sent, the receiver waits forever. Reject in uv__check_before_write() instead, so uv_write2() fails synchronously and callers see ENOSYS. This mirrors the Cygwin/MSYS arm directly above, which returns ENOSYS for the same reason. Only descriptor passing is affected; IPC byte streams keep working, so plain process.send() and the cluster control protocol are unchanged. Verified on the edgejs WASIX lane: the node:dgram category is unchanged at 60 passed, and a cluster shared-socket bind now surfaces a prompt ENOSYS on the primary instead of stalling silently.
syrusakbary
approved these changes
Aug 11, 2026
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.
Problem
On WASIX,
child.send(message, handle)reports success while the message is silently dropped, and both peers then wait forever.WASI has no
msghdr/SCM_RIGHTS, souv__try_write()already refuses a write carrying a descriptor:But that refusal happens inside the queued write, so
uv_write2()has already returned 0 and the failure is delivered only as a write-completion status. Node's IPC channel discards that status —lib/internal/child_process.jsinstalls:So the sender is told the write succeeded, nothing goes out, and the receiver waits for a message that can never arrive.
Fix
Reject in
uv__check_before_write()souv_write2()fails synchronously and the caller seesENOSYS. This mirrors the Cygwin/MSYS arm immediately above, which returnsENOSYSfor exactly the same reason (cannot pass descriptors).Only descriptor passing changes. IPC byte streams are untouched, so plain
process.send()and the cluster control protocol keep working.Verification
Built into the edgejs WASIX guest and exercised through the Node test suite:
node:dgramcategory: 60 passed, no regressions (the one pre-existing failure,known_issues/test-dgram-bind-shared-ports-after-port-0, is unrelated — it needs realSCM_RIGHTSfd passing and cannot pass on WASIX either way).parent->childandchild->parentround-trip verified).ENOSYSon the primary instead of stalling silently.Before / after for a handle-passing send:
This does not make descriptor passing work — that needs
SCM_RIGHTSsupport in WASIX. It makes the unsupported case fail honestly and promptly instead of hanging.