-
Notifications
You must be signed in to change notification settings - Fork 325
ws_js: return c.closeErr when closed during read #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I am unable to reproduce the test failure locally (when running CI=1 go test ./...
to actually run the WASM tests, and adding debug logs to make sure the test is actually running):
> CI=1 go test ./... -v -run TestWasm
? github.com/coder/websocket/internal/bpool [no test files]
? github.com/coder/websocket/internal/errd [no test files]
? github.com/coder/websocket/internal/test [no test files]
? github.com/coder/websocket/internal/test/assert [no test files]
? github.com/coder/websocket/internal/test/wstest [no test files]
? github.com/coder/websocket/internal/test/xrand [no test files]
? github.com/coder/websocket/internal/util [no test files]
=== RUN TestWasm
=== PAUSE TestWasm
=== CONT TestWasm
conn_test.go:367: Running WASM tests # <- debug log inside TestWasm
--- PASS: TestWasm (8.10s)
PASS
ok github.com/coder/websocket 8.969s
testing: warning: no tests to run
PASS
ok github.com/coder/websocket/internal/xsync (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok github.com/coder/websocket/wsjson (cached) [no tests to run]
It looks like a possible issue starting Chrome in CI? https://github.com/coder/websocket/pull/505/checks#step:4:102
According to an announcement from GitHub, ubuntu-latest
started switching to Ubuntu 24.04 on December 5th: actions/runner-images#10636
Ubuntu 24.04 uses more strict AppArmor policies which may have broken (or now requires) sandboxing for Chrome?
The runner executed with Ubuntu 24.04.1: https://github.com/coder/websocket/pull/505/checks#step:1:4
Return the close error when the WebSocket is closed (when running in WASM).
Previously, when the WebSocket connection is closed by the server,
Read
always returnsnet.ErrClosed
, which prevents the correct handling of a close error with certain close status codes.This might not be the best way to fix this, however we have been using this patch in production since June and it appears to resolve the issue and makes it possible to implement logic depending on the close code.