Skip to content
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

fix(gql_websocket_link): Fix race condition causing exception and double complete #471

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

james-pellow
Copy link

There is a race condition in the subscribe function of the _Client class. If the dispose function returned by the subscribe method is called which calls the releaser() method, and then a CompleteMessage is received on the websocket while the releaser() is awaiting to compose its own CompleteMessage, then releaser() is called twice and the request is double released causing an exception. I've added a flag to avoid a double release.

The second patch simply avoids the situation where a websocket is already closed when an error occurs, causing an already completed exception when completeError() is called on the completer.

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