-
Notifications
You must be signed in to change notification settings - Fork 31
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
Replace obsolete websocket library -- allows WebAssembly #433
Conversation
@Jmgr is this PR still relevant? |
I believe so, unless we don't care about WebAssembly? That's quite a small change also. |
@Jmgr could you solve the conflicts when you get an opportunity then and then i can assign some reviewers :) |
f0ea2a8
to
bcb2c3b
Compare
Done. |
I just took a look at the test that's failing, its TestRealtime_RSC7_AblyAgent/RSC7d3_:_Should_set_ablyAgent_header_with_correct_identifiers It's failing because the header was expected to be But it's actual : "" This might be because in ably/websocket.go there's this deleted line... config.Header.Set(ablyAgentHeader, ablyAgentIdentifier) Hope this helps |
Yep, that was the issue, thanks. |
@Jmgr we have a few known issues currently open for unstable tests they are #526 #519 #512 #508 #502 #472 To assist us with unstable tests we have a test observability server here https://test-observability.herokuapp.com/repos which we are actively using to identify, fix and re-stabilise the tests in CI. Taking a look now for this specific branch, I can see this test So I think there could be something specific in this PR causing that specific intermittent test failure. |
Looking deeper, the specific error for the test
This test causes a send error and expect message to be enqueued and transport to be closed. Except after transport is closed, it doesn't seem to be reconnecting instantly as the send it tries to make after close is sometimes timing out. Do you think switching the websocket library might have caused this? |
Given the current situation on this project with integration test stability, I have raised #541 I think the responsible thing to do here is to add unit tests before switching the websocket package. Having greater confidence in the tests which will allow us to make this change with certainty that no new issues have been introduced. |
I've just noticed that lines 144 and 145 of
these two lines can be removed. |
Co-authored-by: Rosie Hamilton <Rosalita@users.noreply.github.com>
Co-authored-by: Rosie Hamilton <Rosalita@users.noreply.github.com>
…bly-go into feature/webassembly-compatibility
Some observations on the test failures that are happening for this branch: While unit tests pass, it looks integration tests have failed for 3 out of 4 attempts. The integration test which is failing is Inspecting this test I can see that it uses a custom dial function to make the websocket connection. The unit test for websockets only test the default dial function. This would explain why the unit tests pass but this integration test is failing. The integration test is failing because it is timing out waiting for send, however it is worth noting that the test is not failing 100% of the time. Indicating that it has become flakey, most likely due to a race or timing problem. Inspecting the custom dial function in this test, it sets up the websocket connection in such a way that:
The dial function uses an unbuffered channel called The test creates a new realtime client using the custom dial function. Then this test makes a new channel called publishErr, which is a buffered channel which can hold 1 message and starts a new concurrent Go routine to publish a message named "test" to a channel named "test". The result of that publish is sent to the Then it looks like the test asserts that the It also asserts that the go routine which published to a channel didn't experience an error when publishing. Then the test tries to instantly send an empty struct to the So it looks like the code that is failing here is code in package I'm not sure yet why the |
I've found two ways to fix this test locally:
Given that the websocket package was changed, the new websocket package may sometimes take slightly longer to close a connection than the old package did. I think the most sympathetic way to stop this test from failing some of the time would be to go with option 1 to increase the timeout from 10ms to 20ms. |
This is a quick fix for enabling websocket tests to pass using nhooyr.io/websocket. In the long term we would probably want to remove all timeouts in tests though.
I tested this morning and ran the |
…ert timeout changes
…bly-go into feature/webassembly-compatibility
Co-authored-by: Rosie Hamilton <Rosalita@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for all the effort one this one. I'm happy to approve 👍
No worries, thanks for the help in getting this done! |
This replaces the unmaintained
golang.org/x/net/websocket
websocket library withnhooyr.io/websocket
. This allows compiling go-ably to WebAssembly and using Ably from a browser.resolves #368