Repository navigation
fix: propagate HTTP version and sync quit state in selenium-bridge - #2510
Merged
mykola-mokhnach merged 4 commits intoNov 26, 2026
Merged
mykola-mokhnach merged 4 commits into
mykola-mokhnach merged 4 commits into
Conversation
Abdelrhman-Ellithy
requested review from
SrinivasanTarget,
mykola-mokhnach,
saikrishna321 and
valfirst
as code owners
November 26, 2026 08:05
valfirst
approved these changes
Nov 26, 2026
mykola-mokhnach
left a comment
Contributor
There was a problem hiding this comment.
- [minor]
BridgedRemoteWebDriver.java:84: the eviction only runs when the bridge's ownquit()is called. AfterappiumDriver.quit()alone, a laterSeleniumBridge.asRemoteWebDriver(appiumDriver)still returns the cached bridge, becauseisBiDiClosed()is false. That bridge has a dead session and an open WebSocket. I understand this is out of scope for the PR. Even so, shouldasRemoteWebDrivercheckdriver.getSessionId() == nullon the cached path, then evict, close BiDi and fail fast?doesNotSendDuplicateDeleteWhenDelegateQuitFirstonly passes the eviction assertion because it also callsseleniumDriver.quit()afterwards. - [nit]
docs/selenium-bridge.md:19-20and theSeleniumBridge.asRemoteWebDriverJavadoc: they say the same instance is returned while BiDi is open. They don't mention that afterquit()the cache entry is gone and a newasRemoteWebDriver(...)call throwsSessionNotCreatedException.
mykola-mokhnach
left a comment
Contributor
There was a problem hiding this comment.
No general findings. The change looks correct; the inline notes are minor and nit.
Contributor
Author
|
@mykola-mokhnach addressed all four notes in the last commit. |
mykola-mokhnach
left a comment
Contributor
There was a problem hiding this comment.
- [minor] The PR description no longer matches the code. It says
BridgedRemoteWebDriver#quit()evicts the delegate fromBRIDGESinfinally, with constructor-rollback guards alongsidecloseBiDi(). The last commit moved eviction intoSeleniumBridge.asRemoteWebDriver(...), which evicts lazily when the driver has no session. Please update the Change list and Details so the description says that.
| */ | ||
| @Override | ||
| public void quit() { | ||
| Throwable quitFailure = null; |
Contributor
There was a problem hiding this comment.
[nit] quit() now nests try/catch/finally/try/catch, with the null guard and suppression bookkeeping in the middle. Consider extracting the cleanup into a helper such as closeBiDiAfterQuit(Throwable quitFailure). It would do the null guard, call closeBiDi(), and either rethrow or addSuppressed. quit() would then read as "super.quit(), then close BiDi, keeping the quit failure as primary".
mykola-mokhnach
approved these changes
Nov 26, 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.
Change list
AppiumClientConfig#version()to Selenium'sClientConfiginBridgedRemoteWebDriver#toSeleniumConfig(...)when non-null, and updatedocs/selenium-bridge.md.DriverCommand.QUITinSeleniumCommandExecutorthroughdelegate.quit()when quit is enabled so bothBridgedRemoteWebDriverandAppiumRemoteWebDriverclear theirsessionIdwith a singleDELETE /session/:idrequest.driver.getSessionId() == nullup front in bothSeleniumBridge.asRemoteWebDriver(...)overloads, evict any stale cached bridge lazily inSeleniumBridge.asRemoteWebDriver(AppiumRemoteWebDriver), and fail fast withIllegalStateException.closeBiDiAfterQuit(@Nullable Throwable)inBridgedRemoteWebDriver#quit()with constructor-rollback null guards so any primary failure fromsuper.quit()is preserved andcloseBiDi()exceptions are attached viaaddSuppressed.SeleniumBridgeTestcovering HTTP version forwarding, single-DELETE quit synchronization, delegate-quit-first idempotency, lazy eviction +IllegalStateExceptionchecks,closeBiDi()failure propagation/suppression, and cleanup whenquit()fails.Types of changes
Details
BridgedRemoteWebDriver#toSeleniumConfigforwarded timeouts, proxy, credentials, and SSL context fromAppiumClientConfig, but omittedsource.version(), ignoring configured HTTP versions (e.g.HTTP_2).AppiumClientConfig.defaultConfig().version()defaults to"HTTP_1_1", whereas Selenium'sClientConfig.defaultConfig().version()defaults tonull(falling back to JDKHttpClient's default). Forwardingsource.version()when non-null intentionally aligns the bridged client with the driver'sAppiumClientConfig(matching the existing timeout/proxy/credentials/SSL forwarding); callers wanting"HTTP_2"ornullcan configure it onAppiumClientConfig.quit()state & stale bridge cache: CallingseleniumDriver.quit()previously sentDELETE /session/:iddirectly throughdelegate.getCommandExecutor(), bypassingAppiumRemoteWebDriver#quit()and leavingdelegate.getSessionId()non-null while a cached bridge could remain inSeleniumBridge.BRIDGES. RoutingDriverCommand.QUITthroughdelegate.quit()keeps both drivers synchronized with a singleDELETErequest, even when the server returns an error on quit. SubsequentSeleniumBridge.asRemoteWebDriver(...)calls checkdriver.getSessionId() == nullup front, evict lazily fromBRIDGESon the cached overload, and fail fast withIllegalStateException. InBridgedRemoteWebDriver#quit(),closeBiDiAfterQuit(...)handles constructor rollback ifsuper(...)invokesquit()beforewebSocketClientsis initialized and keepssuper.quit()exceptions primary whencloseBiDi()also throws.(Note: Kept strictly scoped to
selenium-bridgewithout modifyingAppiumRemoteWebDriver#quit().Verification
./gradlew :checkstyleMain :javadoc :selenium-bridge:checkstyleMain :selenium-bridge:checkstyleTest :selenium-bridge:javadoc :selenium-bridge:test(18/18 tests passing, no new warnings).