Skip to content

Add a few timeouts to FlutterDriver.connect() - #16762

Merged
tvolkert merged 2 commits into
flutter:masterfrom
tvolkert:driver
Apr 19, 2018
Merged

tvolkert merged 2 commits into
flutter:masterfrom
tvolkert:driver

Conversation

@tvolkert

Copy link
Copy Markdown
Contributor

We're seeing occasional test timeouts trying to call FlutterDriver.connect().
Unfortunately, when the test is timed out at the test runner level, you don't
get a meaningful test failure or stack trace of where the timeout occurrred.
Your test harness also doesn't get to clean up, which can include things like
saving the device logs to see what was going on in the device.

Thuss, this change adds configurable timeouts in the places where we've most
commonly observed hangs during tests.

We're seeing occasional test timeouts trying to call `FlutterDriver.connect()`.
Unfortunately, when the test is timed out at the test runner level, you don't
get a meaningful test failure or stack trace of where the timeout occurrred.
Your test harness also doesn't get to clean up, which can include things like
saving the device logs to see what was going on in the device.

Thuss, this change adds configurable timeouts in the places where we've most
commonly observed hangs during tests.
@tvolkert
tvolkert requested a review from goderbauer April 19, 2018 20:40
@tvolkert
tvolkert requested a review from yjbanov April 19, 2018 20:40

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

_log.info('Connecting to Flutter application at $dartVmServiceUrl');
final VMServiceClientConnection connection = await vmServiceConnectFunction(dartVmServiceUrl);
final VMServiceClientConnection connection = await vmServiceConnectFunction(dartVmServiceUrl)
.timeout(vmServiceConnectTimeout, onTimeout: () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.timeout does not cancel the original Future (futures cannot be cancelled in general). So after it times out the connection function will continue attempting to connect. If you look at the implementation of the default connection function _waitAndConnect it already has a timeout. It's just hard-coded to _kLongTimeout. A more robust strategy might be to customize that timeout value.

@tvolkert

Copy link
Copy Markdown
Contributor Author

@yjbanov updated - PTAL

@tvolkert
tvolkert merged commit 9da0ec2 into flutter:master Apr 19, 2018
@tvolkert
tvolkert deleted the driver branch April 19, 2018 22:09
@yjbanov

yjbanov commented Apr 19, 2018

Copy link
Copy Markdown
Contributor

lgtm

DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
We're seeing occasional test timeouts trying to call `FlutterDriver.connect()`.
Unfortunately, when the test is timed out at the test runner level, you don't
get a meaningful test failure or stack trace of where the timeout occurrred.
Your test harness also doesn't get to clean up, which can include things like
saving the device logs to see what was going on in the device.

Thus, this change adds timeouts in the places where we've most
commonly observed hangs during tests.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants