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

Update k6 and add tests around races #42

Merged
merged 3 commits into from
Apr 5, 2023
Merged

Update k6 and add tests around races #42

merged 3 commits into from
Apr 5, 2023

Conversation

mstoykov
Copy link
Collaborator

@mstoykov mstoykov commented Apr 4, 2023

Before the update of k6 it was possible that a websocket connection will start stopping due to context Done. That will use the eventloop to synchronise the update of the statuses and the closing of the done channel.

And everything will work except if the eventloop was not already stopping due to unhandled exception (for example).

In that case the eventloop will just not run the call to stop the connection.

Detecting that is inherently hard and will require to then have a separate mechanism to close and stop the websocket connection that is only used in this particular case.

The test provided also caught leakage of goroutines which is now caught and fixed.

fixes #36

Before the update of k6 it was possible that a websocket connection will start
stopping due to context Done. That will use the eventloop to synchronise
the update of the statuses and the closing of the done channel.

And everything will work *except* if the eventloop was not already
stopping due to unhandled exception (for example).

In that case the eventloop will just not run the call to stop the
connection.

Detecting that is inherently hard and will require to then have
a separate mechanism to close and stop the websocket connection that is
only used in this particular case.

The test provided also caught leakage of goroutines which is now caught
and fixed.

fixes #36
websockets/websockets.go Outdated Show resolved Hide resolved
websockets/websockets.go Outdated Show resolved Hide resolved
Co-authored-by: Oleg Bespalov <oleg.bespalov@grafana.com>
@mstoykov mstoykov merged commit d2d4b5a into main Apr 5, 2023
@mstoykov mstoykov deleted the fix36 branch April 5, 2023 12:37
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.

Potential lock up
2 participants