Add retry logic to Firefox driver startup#1580
Merged
akoeplinger merged 2 commits intomainfrom Apr 4, 2026
Merged
Conversation
GetFirefoxDriver used CreateWebDriver which has no retry, while GetChromiumDriver has a 3-attempt retry loop for transient startup failures. This causes flaky CI failures when geckodriver takes time to bind to its port — xharness gets 'Connection refused' errors followed by 'Cannot start the driver service' and exits with code 71. Add the same retry pattern to GetFirefoxDriver: 3 attempts with retryable error snippets including 'Cannot start the driver service' and 'Connection refused'. Also enable verbose geckodriver logging to aid future diagnosis. Related: dotnet/runtime#104349, dotnet/runtime#126489 Co-authored-by: Copilot <[email protected]>
…iverService FirefoxDriverService in Selenium 4.0.0-alpha05 does not have EnableAppendLog, EnableVerboseLogging, or LogPath properties. These are ChromiumDriverService-specific. Remove them from the Firefox retry loop. Co-authored-by: Copilot <[email protected]>
akoeplinger
approved these changes
Apr 4, 2026
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.
Summary
Adds the same startup retry logic that Chrome/Edge already have to the Firefox (geckodriver) path.
Problem
GetFirefoxDriverusesCreateWebDriverwhich tries once and throws on failure.GetChromiumDriverhas a 3-attempt retry loop. When geckodriver takes time to bind to its port, xharness gets repeatedConnection refusederrors followed byWebDriverException: Cannot start the driver serviceand exits with code 71 (GENERAL_FAILURE).This is a known CI flake pattern — dotnet/runtime#104349 tracked the same
Connection refusedissue and hadBuildRetry: trueas a workaround.Example from dotnet/runtime build 1365445:
Fix
GetFirefoxDrivermatching the Chromium patternWebDriverExceptionwith known retryable error snippets:Cannot start the driver service,Connection refused,exited abnormally,failed to startPrior art
e439337— Chrome DevToolsActivePort retry fix (same repo)[browser] Connection refusedKBE