Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
joshuasing wants to merge 1 commit into coder:master
base: master
Choose a base branch
Loading
from hemilabs:joshua/fix-wasm-close-err

Conversation

Copy link

@joshuasing joshuasing commented Dec 19, 2024

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 returns net.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.

shynome and jalius reacted with heart emoji
Copy link
Author

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

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /