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

Improve browser close detection #1444

Open
Tracked by #1440
inancgumus opened this issue Sep 25, 2024 · 0 comments
Open
Tracked by #1440

Improve browser close detection #1444

inancgumus opened this issue Sep 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@inancgumus
Copy link
Member

inancgumus commented Sep 25, 2024

Originally posted by @inancgumus in #1442 (comment)

if !b.browserOpts.isRemoteBrowser {
var closeErr *websocket.CloseError
// Using the internal context with a timeout of 10 seconds here since
// 1. vu context will very likely be closed;
// 2. there's a chance that the process has died but the connection still
// thinks it's open.
toCtx, toCancelCtx := context.WithTimeout(b.browserCtx, time.Second*10)
defer toCancelCtx()
err := cdpbrowser.Close().Do(cdp.WithExecutor(toCtx, b.conn))
if err != nil && !errors.As(err, &closeErr) {
b.logger.Errorf("Browser:Close", "closing the browser: %v", err)
}
}

I worry that we would need to change this whenever a larger timeout is needed. A larger timeout can cause prematurely aborted errors from the engine team. Two hopefully possible solutions:

  • Implementing our own Context implementation that automatically cancels when the process is dead
  • Making this an environment variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant