-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Reland "Make sure all isolates start during flutter driver tests" #64432
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
07359bb to
54e136e
Compare
|
Thanks for your work, looks great! Only thing is I don't think the examples directory is the best place, github.com/flutter/tests may be it. For the VMNoneEvent issue, have you seen https://github.com/flutter/flutter/blob/54e136e70dbfd0810c5fe24b841e9f015e6795cd/packages/flutter_driver/lib/src/driver/vmservice_driver.dart#L106? |
|
Internal testing is much happier with this change, only 1 failed test. A hot reload change on Android that crashes during Root cause may be #26953 (cc @DanTup) Relevant logs: Interestingly, adding a tiny delay caused the test to pass. |
|
I don't have any visibility of internal code so I can't offer much insight, but it seems like the (I'm not sure if it's related to #26953 though - the extra isolates in that issue are weird, but I wouldn't expect them to affect getting a response to |
99c0872 to
9ee9bfe
Compare
|
Remembering to cancel the subscription fixed the bug. |
|
The presubmit checks look OK, let me know if you think there is more for me to do on those. The windows failure failure looks unrelated to my change, I'm guessing that's a problem at head, not something new with this pull request. |
|
I'm rerunning "hostonly_devicelab_tests-2-windows" to see if the failure is just a flaky test. |
|
Woohoo! Just waiting for the flutter build to be fixed now. Is someone willing/able to tag this with waiting for tree to go green? |
|
It's really unfortunate that that test still isn't passing. @dnfield I've looked in this and can't determine the root cause. Could you please have a look? (sponge2/d7d06397-8953-429d-a446-fcc58ab25236) |
|
Can someone send me a log for the failing test? (Or is it new_gallery_transition_perf/new_gallery_ios__transition_perf? I can run those directly.) If the error is still of the variety Bad state: The client closed with pending request "ext.flutter.driver", perhaps we should catch exceptions as the VM service client closes? |
|
There seem to be two different errors. Type A: Type B: These are happening in the host script - the logs on the emulators aren't showing any obvious errors to me. |
|
One red flag here is that driver is still using |
|
Interesting. Two different errors, both happening while establishing the VM connection. I have not seen these at all when testing locally. Any additional information available about what these test cases are trying to test for? Is this a hot restart/reload during the initial setup? I can probably recreate that condition locally if I add sleep() statements in enough places. =) I did notice that the vm service client library has some deprecation warnings. Anybody have thoughts on how much work it would be to replace it with the modern version...? |
|
The type B error makes sense to me and is fixable. There's a race condition between the isolate becoming runnable and the VM canceling/removing the isolate for some other reason. The isolateRef.load() call can fail, and that's harmless. Catching the exception would fix it. The type A error is still confusing. Any ideas about what could cause that would be helpful, I suspect I'm misreading the code flow. |
|
Context for the type A error: The test is a wrapper/host for a counter app that auto-increments itself. The runner is sent the letters 'r' and 'R' to trigger a hot reload and hot restart, respectively. From the video recording, the test crashes sometime after a successful hot restart, possibly during tearDown |
9ee9bfe to
d1a88cb
Compare
|
I was able to reproduce this by adding a sleep statement towards the end of a test case, and then repeatedly restarting the app. Somewhat different root causes for A and B. The uncollected sentinel error happens if the onIsolateRunnable() callback produces a new isolate, but the isolate is destroyed before the call to isolateRef.load(). Fix is to handle that exception gracefully. The pending call error is more subtle, but making sure to wait for the results of _resumeLeniently in the onIsolateRunnable callback seems to have fixed it. I think the issue here was that stream cancellation waits for the pending callback to finish. Before: stream cancellation wrapped up early, then the vm service client close would interrupt the pending call. Now: stream cancellation waits for the pending callback to finish. Finally, there is still a race condition during driver connection: if the VM is restarted while we're still loading the first isolate in connect(), things go badly. That's an existing problem, and it's unclear what correct behavior would be. Maybe a retry? I'm not inclined to fix it in this pull request, but let me know if you want me to go for it. |
|
Nice! We're also updating the internal tests to use |
|
I'm not sure what the infra failure here is about - @godofredoc or @digiter may know. @guidezpl - do these changes now pass internally? Switching to package:vm_service will likely require changes upstream in flutter/driver. |
|
We have an update on the builders, please rebase to the HEAD of master and retry tests. |
d1a88cb to
7d0420c
Compare
|
testonly_devicelab_tests is still timing out after 3 hours, with no debug output that I've been able to find. Any tips on debugging this? Or on reproducing the problem locally? |
Please rebase and upload a new commit. Those tests were removed like a week ago. |
7d0420c to
aab15da
Compare
|
Weird, I thought I rebased yesterday, but I still had the failing ancient tests. Just rebased again, and this time it seems to have gone well. Crossing my fingers that the tests pass! |
…sts" (flutter#64432)" (flutter#65635) This reverts commit ccd4f6d.
Description
Fixes #24703.
Flutter driver has problems when flutter apps use more than a single isolate. The other isolates don't start, so apps malfunction. This PR fixes the problem by listening for new isolates to become runnable, and automatically starting them.
There was significant discussion of a prior version of this fix in #63167. I wrecked my git change history with a bad merge, so this is a cleaned up version of the PR.
Related Issues
#24703.
Tests
I added the following tests:
I added the following tests:
Checklist
Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].