-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 buffered chan event system #3968
Conversation
If we drop events due to the default case then we can end up in a situation where either the event system indefinitely waits since done events were not handled or the extension waits indefinitely if the event was dropped when sending it the event.
4965154
to
d0781c6
Compare
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.
LGTM 👍 One point to keep in mind: More calls to Done
than the number of subscribers will again block :)
Yeah, that's a good point. I hadn't considered the reason why there was a Having looked at this again, I still feel that this is the correct approach. Dropping done events or the events going to the extension will mean that one of the two will misbehave, either the extension will hang indefinitely or k6 will. In the extension side (i.e. in browser) we could call e.Done() on a goroutine for the exit event. We don't want the browser module to hang around waiting for There is the chance that the subscriber could have called subscribe twice and handle the same subscription in the same goroutine, this could cause a deadlock (I think). This feels like user error though. |
The PR we're interested in is grafana/k6#3968.
The PR we're interested in is grafana/k6#3968.
The PR we're interested in is grafana/k6#3968.
The PR we're interested in is grafana/k6#3968.
What?
This removes the
default
case for when reading done events from the extension or when sending events to the extension.Why?
If we drop events due to the channel being full and there being a
default
case, then we can end up in a situation where either the event system indefinitely waits since incoming done events were not handled by the event system or the extension waits indefinitely if the event was dropped when sending it the event.Checklist
make lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
grafana/xk6-browser#1440