Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix WebSocket is not open: readyState 2 (CLOSING) #70

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

rkistner
Copy link
Contributor

The issue was that the removeAllListeners() on close also removes the error handler. So if an error on the socket is triggered after closing, it ended up as an uncaught exception, crashing the process.

This only appears to happen when there is a combination of:

  1. The socket is closed by the server, e.g. from a keepalive timeout.
  2. A lot of data to be sent is buffered.

This may reduce the need for some of the workarounds implemented in #11, although they probably don't hurt.

Copy link

changeset-bot bot commented Aug 29, 2024

🦋 Changeset detected

Latest commit: 0d4432d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@powersync/service-rsocket-router Patch
@powersync/service-core Patch
@powersync/service-image Patch
test-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing find and fix!

@rkistner rkistner merged commit 164e1ee into main Aug 29, 2024
8 checks passed
@rkistner rkistner deleted the fix-websocket-closing-error branch August 29, 2024 13:32
@Rentacookie
Copy link
Contributor

Thank you Ralf 🙏

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants