Skip to content

fix: pause newCommandTimeout during mobile: activateApp/launchApp - #940

Merged
KazuCocoa merged 1 commit into
appium:mainfrom
masaaki-hori:fix/mobile-launch-app-command-timeout
Oct 19, 2026
Merged

KazuCocoa merged 1 commit into
appium:mainfrom
masaaki-hori:fix/mobile-launch-app-command-timeout

Conversation

@masaaki-hori

Copy link
Copy Markdown
Contributor

Problem

The mobile:(activateApp|launchApp) branch of FlutterDriver#executeCommand bypasses
BaseDriver.executeCommand, so the FlutterDriver newCommandTimeout is never cleared while the
command runs. reConnectFlutterDriver can wait for the observatory URL for up to
maxRetryCount × retryBackoffTime, and once that exceeds newCommandTimeout (60s by default)
the session is deleted in the middle of the command.

Since #936 made mobile: launchApp go through this branch, this is easier to hit. In a fork's
iOS functional run, the session was torn down 60s after mobile: launchApp:

Shutting down because we waited 60 seconds for a command
Ending session, cause was 'New Command Timeout of 60 seconds expired. ...'

and the reconnect that finished later failed against the deleted session.

Fix

Clear the timeout before proxying the command and restart it in a finally block, the same way
the proxy branch of executeCommand already does. The timeout is restarted even when the
reconnect throws.

Tests

driver/test/mobile-launch-app.test.mjs now also asserts the order
clearNewCommandTimeout → proxied command → startNewCommandTimeout when the reconnect fails.
That case fails on the current main and passes with this change.

🤖 Generated with Claude Code

The mobile:(activateApp|launchApp) branch of executeCommand bypasses
BaseDriver.executeCommand, so the FlutterDriver newCommandTimeout kept
running while reConnectFlutterDriver waited for the observatory URL. When
that wait exceeded the timeout (60s by default), the session was deleted
mid-command. Clear the timeout for the whole command and restart it in a
finally block, as the proxy branch already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KazuCocoa
KazuCocoa merged commit d57c197 into appium:main Oct 19, 2026
5 of 6 checks passed
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