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 dispose context canceled errors #1261

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Apr 5, 2024

What?

Ignore context canceled errors when attempting to dispose of a frame.

Why?

When testing websites which contain iframes, they can cause a panic: GoError: dispose: canceled panic. This is confusing behaviour since after investigating the issue it turns out that the dispose doesn't need to occur since the page the iframe is associated to is already closed. More details can be found in this comment.

It's worth noting that this is more of a work around. A better solution might be to not end the iteration until all the CDP messages between k6 and Chrome ended successfully, but this would require quite a bit of refactoring and possibly more control over the iteration.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

#1089

@ankur22 ankur22 marked this pull request as draft April 5, 2024 16:12
@ankur22 ankur22 changed the base branch from main to fix/exec-context-session April 5, 2024 16:13
@ankur22 ankur22 force-pushed the fix/exec-context-session branch from b398508 to 3405f11 Compare April 5, 2024 16:34
@ankur22 ankur22 force-pushed the investigate/dispose-constext-canceled branch from beba74e to e8440a0 Compare April 8, 2024 08:56
@ankur22 ankur22 requested a review from inancgumus April 8, 2024 16:03
@ankur22 ankur22 marked this pull request as ready for review April 9, 2024 08:04
common/js_handle.go Outdated Show resolved Hide resolved
@ankur22 ankur22 force-pushed the fix/exec-context-session branch from 3405f11 to a752709 Compare April 22, 2024 10:22
@ankur22 ankur22 force-pushed the investigate/dispose-constext-canceled branch from e8440a0 to f2817ff Compare April 23, 2024 08:02
@ankur22 ankur22 changed the base branch from fix/exec-context-session to main April 23, 2024 08:16
@ankur22 ankur22 force-pushed the investigate/dispose-constext-canceled branch from f2817ff to 4ad0c4d Compare April 23, 2024 09:03
@ankur22 ankur22 marked this pull request as draft April 23, 2024 09:03
@ankur22 ankur22 force-pushed the investigate/dispose-constext-canceled branch from 4ad0c4d to 72e66c3 Compare April 23, 2024 09:11
@ankur22 ankur22 changed the title Investigate dispose context canceled Fix dispose context canceled errors Apr 23, 2024
@ankur22 ankur22 marked this pull request as ready for review April 23, 2024 09:14
If the context is closed, and that is the error that is received by the
dispose method, then that would elude to the fact that the iteration
has ended. Therefore, we shouldn't need to panic or log an error at
this point, and instead just continue on as normal. The page has closed
well before this panic occurs.
@ankur22 ankur22 force-pushed the investigate/dispose-constext-canceled branch from 72e66c3 to 483952a Compare April 23, 2024 11:11
@ankur22 ankur22 merged commit ab431b5 into main Apr 23, 2024
17 checks passed
@ankur22 ankur22 deleted the investigate/dispose-constext-canceled branch April 23, 2024 13:13
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.

2 participants