Fix Chrome DevToolsActivePort crash retry for Selenium 4.0.0-alpha05#1563
Merged
Fix Chrome DevToolsActivePort crash retry for Selenium 4.0.0-alpha05#1563
Conversation
The retry logic in GetChromiumDriver only catches TargetInvocationException when the inner exception is WebDriverException. However, Selenium 4.0.0-alpha05 throws InvalidOperationException (not WebDriverException) for 'session not created: Chrome failed to start: crashed' errors that include 'DevToolsActivePort file doesn't exist'. This means the retry never fires for this common transient failure, causing intermittent test failures across CI (dotnet/runtime#124438). Changes: - Broaden catch to also match InvalidOperationException inner exceptions - Add 'DevToolsActivePort file doesn't exist' to retryable error snippets - Detect Windows containers via DOTNET_RUNNING_IN_CONTAINER env var for --no-sandbox (/.dockerenv only exists on Linux) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
steveisok
approved these changes
Mar 14, 2026
Member
Author
|
/ba-g failures are fixed by #1564 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes dotnet/runtime#124438 — intermittent
DevToolsActivePort file doesn't existfailures in WasmTestOnChrome Helix work items.Chrome intermittently crashes on startup in Windows containers, producing:
The existing retry logic in
GetChromiumDriver(3 attempts) never fires for this error because:TargetInvocationExceptionwith innerWebDriverExceptionInvalidOperationException(notWebDriverException) for "session not created" errorsDevToolsActivePortEvidence
From build 1335359, Helix job
8130ae19:Fix
InvalidOperationExceptioninner exceptions (not justWebDriverException)DevToolsActivePort file doesn't existto the retryable patterns--no-sandbox: also checkDOTNET_RUNNING_IN_CONTAINERenv var (Linux Docker detection via/.dockerenvdoesn't work on Windows containers)