-
Notifications
You must be signed in to change notification settings - Fork 42
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 hanging close browser cdp req #1442
Conversation
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.
👍 Thanks! Before merging, should we wait for the k6 side of the fix?
Yep, good idea. I can then update k6 in this PR with the fix. Done in 1095480 |
675d409
to
aa6a1c0
Compare
Use the existing background context instead of creating a new one.
Use the existing background context instead of creating a new one.
Since the context that is used is a essentially a background context, we need to have a timeout in place. There is a chance that the browser process has already exited but the connection thinks it is still alive. By using the timeout we're ensuring that the iteration can end, which allows for the events to be emitted by the k6 event system and so allow k6 to exit in a timely manner.
Working with c.ctx will essentially never end since it is basically a background context. Using the passed in context which has a timeout will help ensure the send goroutine ends quickly.
The PR we're interested in is grafana/k6#3968.
aa6a1c0
to
b4b16ba
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.
Reapproving :)
What?
We're putting a timeout on the CDP close request.
Why?
This is so that the connection is closed and we allow the iteration to end. Without this, the browser module can be left hanging indefinitely on the cdp send (well, waiting for the response from chromium) when actually chromium has already exited.
Checklist
Related PR(s)/Issue(s)
Updates: #1440