Skip to content

fix(netwatch): close the socket inline on drop for single-threaded targets - #2

Open
lann wants to merge 1 commit into
mainfrom
wasi-inline-socket-close
Open

fix(netwatch): close the socket inline on drop for single-threaded targets#2
lann wants to merge 1 commit into
mainfrom
wasi-inline-socket-close

Conversation

@lann

@lann lann commented Aug 7, 2026

Copy link
Copy Markdown
Owner

UdpSocket::drop defers the libc close to spawn_blocking, which panics on wasi (no blocking pool, no worker threads) — the first dropped socket takes the guest down. On posix_minimal targets close inline instead; close does not block there.

Review notes for an eventual upstream port: (a) as written this also changes espidf (the other posix_minimal target) from deferred to inline close — espidf has threads, so upstream may prefer keying the cfg to wasi alone; (b) behavior when no runtime is current is unchanged in effect (the socket closes either way), the change only moves where the close runs.

Branched from netwatch-v0.19.1 (the version iroh main requires) — see polymorph-components/polymorph-iroh#25. Sibling: the posix_minimal wasi routing. Both merged into the long-lived polymorph-iroh branch the experiments consume.

…rgets

`UdpSocket::drop` defers the libc close to `spawn_blocking`, which
panics on wasi (no blocking pool, no worker threads). On
`posix_minimal` targets close inline instead — close does not block
there.

Part of running iroh on wasm32-wasip2 components
(polymorph-components/polymorph-iroh#25).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant