-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add a few timeouts to FlutterDriver.connect() #16762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
goderbauer
left a comment
There was a problem hiding this comment.
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: () { |
There was a problem hiding this comment.
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.
|
@yjbanov updated - PTAL |
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.

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.