Skip to content
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

"Run app to dismiss dialogs" flakey with iOS 17 devices #141383

Open
Tracked by #142449
vashworth opened this issue Jan 11, 2024 · 49 comments
Open
Tracked by #142449

"Run app to dismiss dialogs" flakey with iOS 17 devices #141383

vashworth opened this issue Jan 11, 2024 · 49 comments
Labels
P2 Important issues not at the top of the work list team-infra Owned by Infrastructure team triaged-infra Triaged by Infrastructure team

Comments

@vashworth
Copy link
Contributor

Type of Request

bug

Infrastructure Environment

Recipes

What is happening?

Seems that the "Run app to dismiss dialogs" step is flakey when using iOS 17 devices. In this step, we test the Xcode project infra-dialog.xcodeproj using the device id. For some reason, xcodebuild does not find the device

Command line invocation:
     /opt/flutter/xcode/15a240d/XCode.app/Contents/Developer/usr/bin/xcodebuild -project infra-dialog.xcodeproj -scheme infra-dialog -destination id=00008030-00026D8034E0C02E test CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=S8QB4VV633 "PROVISIONING_PROFILE_SPECIFIER=match Development *"
 User defaults from command line:
     IDEPackageSupportUseBuiltinSCM = YES
 Build settings from command line:
     CODE_SIGN_STYLE = Manual
     DEVELOPMENT_TEAM = S8QB4VV633
     PROVISIONING_PROFILE_SPECIFIER = match Development *
 2024-01-10 01:53:20.457 xcodebuild[12184:115274] Writing error result bundle to /var/folders/t6/8ffn121n1gn_h072mh8ryyx40000gp/T/ResultBundle_2024-10-01_01-53-0020.xcresult
 xcodebuild: error: Unable to find a destination matching the provided destination specifier:
 		{ id:00008030-00026D8034E0C02E }
 	Available destinations for the "infra-dialog" scheme:
 		{ platform:macOS, arch:arm64, variant:Mac Catalyst, id:00008103-001240282633001E }
 		{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:00008103-001240282633001E }
 		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
 		{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
 		{ platform:macOS, variant:Mac Catalyst, name:Any Mac }
 		{ platform:iOS Simulator, id:26947589-8C35-4C06-8048-8DD50E391A8E, OS:17.0, name:iPad (10th generation) }
 		{ platform:iOS Simulator, id:26947589-8C35-4C06-8048-8DD50E391A8E, OS:17.0, name:iPad (10th generation) }
 		{ platform:iOS Simulator, id:A9BECBF3-467A-4DFC-867D-9DF5475176AE, OS:17.0, name:iPad Air (5th generation) }
 		{ platform:iOS Simulator, id:A9BECBF3-467A-4DFC-867D-9DF5475176AE, OS:17.0, name:iPad Air (5th generation) }
 		{ platform:iOS Simulator, id:729DE591-EDA3-4E4D-85F5-F0AE17FC113B, OS:17.0, name:iPad Pro (11-inch) (4th generation) }
 		{ platform:iOS Simulator, id:729DE591-EDA3-4E4D-85F5-F0AE17FC113B, OS:17.0, name:iPad Pro (11-inch) (4th generation) }
 		{ platform:iOS Simulator, id:4F408240-55C7-4B52-8EF6-096F60797E1A, OS:17.0, name:iPad Pro (12.9-inch) (6th generation) }
 		{ platform:iOS Simulator, id:4F408240-55C7-4B52-8EF6-096F60797E1A, OS:17.0, name:iPad Pro (12.9-inch) (6th generation) }
 		{ platform:iOS Simulator, id:0B486413-1750-4DBD-A145-CE34D8A04BE5, OS:17.0, name:iPad mini (6th generation) }
 		{ platform:iOS Simulator, id:0B486413-1750-4DBD-A145-CE34D8A04BE5, OS:17.0, name:iPad mini (6th generation) }
 		{ platform:iOS Simulator, id:60B4029F-059E-4EF5-8EF1-87615A9823EA, OS:17.0, name:iPhone 14 }
 		{ platform:iOS Simulator, id:60B4029F-059E-4EF5-8EF1-87615A9823EA, OS:17.0, name:iPhone 14 }
 		{ platform:iOS Simulator, id:D85D9C1C-9771-47F2-9B65-DDFBAA059F9C, OS:17.0, name:iPhone 14 Plus }
 		{ platform:iOS Simulator, id:D85D9C1C-9771-47F2-9B65-DDFBAA059F9C, OS:17.0, name:iPhone 14 Plus }
 		{ platform:iOS Simulator, id:D33C1595-5402-4BD0-93C6-86020D8AD240, OS:17.0, name:iPhone 14 Pro }
 		{ platform:iOS Simulator, id:D33C1595-5402-4BD0-93C6-86020D8AD240, OS:17.0, name:iPhone 14 Pro }
 		{ platform:iOS Simulator, id:E7C0A564-5F33-4F86-A43B-D0E885380741, OS:17.0, name:iPhone 14 Pro Max }
 		{ platform:iOS Simulator, id:E7C0A564-5F33-4F86-A43B-D0E885380741, OS:17.0, name:iPhone 14 Pro Max }
 		{ platform:iOS Simulator, id:731D5C2A-E944-405D-B7E4-DFDA0ECB7ED8, OS:17.0, name:iPhone 15 }
 		{ platform:iOS Simulator, id:731D5C2A-E944-405D-B7E4-DFDA0ECB7ED8, OS:17.0, name:iPhone 15 }
 		{ platform:iOS Simulator, id:B58EF098-31FB-46CB-A1DC-7519C6F6E6B0, OS:17.0, name:iPhone 15 Plus }
 		{ platform:iOS Simulator, id:B58EF098-31FB-46CB-A1DC-7519C6F6E6B0, OS:17.0, name:iPhone 15 Plus }
 		{ platform:iOS Simulator, id:D5C2AFB0-FFEE-4D20-BA58-CD3684D1CDAF, OS:17.0, name:iPhone 15 Pro }
 		{ platform:iOS Simulator, id:D5C2AFB0-FFEE-4D20-BA58-CD3684D1CDAF, OS:17.0, name:iPhone 15 Pro }
 		{ platform:iOS Simulator, id:83B8DB5A-F63D-49F9-8652-4D33A535D03D, OS:17.0, name:iPhone 15 Pro Max }
 		{ platform:iOS Simulator, id:83B8DB5A-F63D-49F9-8652-4D33A535D03D, OS:17.0, name:iPhone 15 Pro Max }
 		{ platform:iOS Simulator, id:C05E571A-3DE3-42B1-B356-8459F34402D4, OS:17.0, name:iPhone SE (3rd generation) }
 		{ platform:iOS Simulator, id:C05E571A-3DE3-42B1-B356-8459F34402D4, OS:17.0, name:iPhone SE (3rd generation) }

Does not to appear to be specific to a particular device, seems to be happening to all of the iOS 17 devices. Also does not happen consistently.

Here are a few examples:

https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_arm64_ios%20flavors_test_ios_xcode_debug/1152/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_arm64_ios%20flavors_test_ios_xcode_debug/1162/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_arm64_ios%20flavors_test_ios_xcode_debug/1168/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20flutter_gallery_ios__start_up_xcode_debug/2409/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20integration_ui_ios_driver_xcode_debug/2413/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20integration_ui_ios_driver_xcode_debug/2416/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20integration_ui_ios_driver_xcode_debug/2420/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20microbenchmarks_ios_xcode_debug/1848/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20microbenchmarks_ios_xcode_debug/1853/overview
https://ci.chromium.org/ui/p/flutter/builders/staging/Mac_ios%20microbenchmarks_ios_xcode_debug/1876/overview

Steps to reproduce

No response

Expected results

No response

@vashworth vashworth added the team-infra Owned by Infrastructure team label Jan 11, 2024
@vashworth
Copy link
Contributor Author

cc @jmagman

@jmagman
Copy link
Member

jmagman commented Jan 11, 2024

! Error: Browsing on the local area network for swarming’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8759297163291757937/+/u/flutter_doctor__2_/stdout

@vashworth
Copy link
Contributor Author

So with iOS 17 devices, it automatically makes all paired devices also wirelessly connected.

Did a bit of research and found this under Xcode 15 Known Issues:

When Xcode is wirelessly connected to a device running iOS 17, Xcode doesn’t automatically switch to using the fastest connection when the device is connected to the Mac using a USB cable. If the wireless connection is slower than the USB connection, Xcode may continue to communicate with the device using the wireless connection.

So perhaps it's a bug with Xcode 15? I don't see any mention of it being resolved in newer Xcode releases, but we could try Xcode 15.2.

@vashworth
Copy link
Contributor Author

@yusuf-goog Do you know if the devices are connected to the network?

@yusuf-goog
Copy link
Contributor

@vashworth they are connected to wifi. Do you want us to put them into airplane modE?

@jmagman
Copy link
Member

jmagman commented Jan 11, 2024

@yusuf-goog Try creating a new vanilla Xcode project and deploy to these phones at least once. That should confirm they are set up for development. It wouldn't be related to Flutter or our particular CI setup.

@yusuf-goog
Copy link
Contributor

Will try deployment on one of the testbeds and get provide an update.

auto-submit bot added a commit that referenced this issue Jan 11, 2024
Reverts #141392
Initiated by: QuncCccccc
This change reverts the following previous change:
Original Description:
Potential fix for #141383.
Markzipan pushed a commit to Markzipan/flutter that referenced this issue Jan 11, 2024
Markzipan pushed a commit to Markzipan/flutter that referenced this issue Jan 11, 2024
Reverts flutter#141392
Initiated by: QuncCccccc
This change reverts the following previous change:
Original Description:
Potential fix for flutter#141383.
@yusuf-goog
Copy link
Contributor

We have opened the device with Xcode 15.2 on mac-39. Please confirm that the device is now in the expected state.

Once thats done, we will setup all remaining iphones which are on iOS 17.

@vashworth
Copy link
Contributor Author

We have opened the device with Xcode 15.2 on mac-39. Please confirm that the device is now in the expected state.

The device on mac-39 still exhibits this issue: https://luci-milo.appspot.com/ui/p/flutter/builders/staging/Mac_arm64_ios%20flavors_test_ios_xcode_debug/1193/overview.

I believe all of the devices are properly set up. All of them have passed the step and ran tests successfully. I tried upgrading to Xcode 15.2 to see if that resolves it, but my PR got reverted. #141420 should reland it. If the upgraded Xcode version doesn't fix it, then perhaps we try airplane mode.

@vashworth
Copy link
Contributor Author

Actually, lets go ahead and put flutter-devicelab-mac-10's device in airplane mode.

@yusuf-goog Let me know when it's done please

@yusuf-goog
Copy link
Contributor

@vashworth mac-10 device has been put into airplane mode.

@vashworth
Copy link
Contributor Author

@yusuf-goog
Copy link
Contributor

Maybe the cmd line --destination id arg has changed with xcode 15? Xcode can connect fine to the device when using the xcode app on mac-39

@yusuf-goog
Copy link
Contributor

yusuf-goog commented Jan 12, 2024

On mac-39, the device showed up correctly under Xcode "devices and simulators" and I was able to click the "take screenshot" button without any warning. But it saved screenshots as black screens.

when trying to deploy a test app on the device, received error message about signing, and had to go through the flow of logging into apple id and importing the provisioning profile into Xcode (https://screenshot.googleplex.com/6SDaGHypNLBggMP.png). After which, screenshots are now appearing as expected.

Note, that before the above import, Xcode showed the match Development * profiles installed on the device. After the above import, it additionally shows a iOS Team Provisioning Profile: * as well.

Lets monitor the builds on mac-39 and see if this has some effect on the failures we are seeing: https://chromium-swarm.appspot.com/bot?id=flutter-devicelab-mac-39

@vashworth
Copy link
Contributor Author

Looks like airplane mode on mac-10 did not work. Also, manual setup for mac-39 also did not work. I think we should try moving this https://flutter.googlesource.com/recipes/+/refs/heads/main/recipe_modules/os_utils/api.py#369 to run before the step - hopefully it can give us some information, such as what connection type it's using

@jmagman
Copy link
Member

jmagman commented Jan 16, 2024

! Error: Browsing on the local area network for swarming’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)

Some VPN/ port issue on Ventura? https://developer.apple.com/forums/thread/741537 Strange it's happening intermittently. Maybe it's fixed on macOS 14.

@yusuf-goog
Copy link
Contributor

These devices are all connected directly to the host via cable, so the network/lan issues should not apply?

@jmagman
Copy link
Member

jmagman commented Jan 16, 2024

These devices are all connected directly to the host via cable, so the network/lan issues should not apply?

That's what that issue and this one are reporting--they are tethered.

@vashworth
Copy link
Contributor Author

vashworth commented Jan 16, 2024

These devices are all connected directly to the host via cable, so the network/lan issues should not apply?

Although they're connected via USB, iOS 17 uses a new device connectivity stack which I believe always uses the network in a way.

Some sources of info:

https://developer.apple.com/forums/thread/737875?answerId=765840022#765840022

iOS 17 has new debugging infrastructure such that all debugging goes over the network. That’s not the same thing as going over Wi-Fi. If you have the device attached via USB, the network requests will go over a virtual network interface running over USB.

https://github.com/doronz88/pymobiledevice3/blob/master/misc/RemoteXPC.md#usb-ethernet

Starting in iOS 17, whenever you connect an iPhone to your macOS, it creates a new network device (with an IPv6 address 😱) using Ethernet over USB - Meaning, the device is always on your LAN and you can communicate with it using Ethernet protocols.

@vashworth
Copy link
Contributor Author

@yusuf-goog Can you upgrade https://chromium-swarm.appspot.com/bot?id=flutter-devicelab-mac-5 to macOS 14 to see if that could fix?

@vashworth
Copy link
Contributor Author

Ok, turns out that you can only change those settings if the internet sharing toggle is set to off.

What combination of options do you want to select for the drop down and the checkboxes?

Share your connection from : Ethernet
To computer using: iPhone USB

@yusuf-goog
Copy link
Contributor

Ok, turns out that you can only change those settings if the internet sharing toggle is set to off.
What combination of options do you want to select for the drop down and the checkboxes?

Share your connection from : Ethernet To computer using: iPhone USB

done

@yusuf-goog
Copy link
Contributor

@vashworth wifi/bluetooth has also been turned off on mac-10 and mac-26 iphones, and put into airplane mode.

@vashworth
Copy link
Contributor Author

vashworth commented Jan 19, 2024

Thanks @yusuf-goog and @kentnguyen99! I'll continue to monitor and see if that fixes

@vashworth
Copy link
Contributor Author

Issue continues to persist across all bots.

@jmagman
Copy link
Member

jmagman commented Jan 22, 2024

Can we get a sysdiagnose off the Mac right after this reproduces?

@vashworth
Copy link
Contributor Author

Can we get a sysdiagnose off the Mac right after this reproduces?

@jmagman Are you suggesting we try to automate it in recipes to run sysdiagnose? Or do it manually after we see the flake happen?

@vashworth
Copy link
Contributor Author

Also, I'm implementing another retry process that if it fails, try reseting and re-selecting Xcode. If it fails again, try clearing Xcode cache and re-installing: https://flutter-review.googlesource.com/c/recipes/+/54300

It seems to me that the only thing that happens between builds where one fails with this flake and one passes is that Xcode is reset and time has passed. And since waiting up to 10 minutes for it to connect doesn't seem to work, I thought we could try resetting Xcode.

@vashworth
Copy link
Contributor Author

vashworth commented Jan 22, 2024

So I was able to catch this happening
https://chromium-swarm.appspot.com/task?id=674b960ee864e110 and was able to test with my CL. Unfortunely, looks like resetting Xcode and even deleting and re-installing Xcode does not work.

I did observe that Finder was still showing the device. Also, when I turned on QuickTime to view the device, it suddenly connected (which cause step 39.4.5 to pass). QuickTime showed that the device was booted and on. So seems like the device is still connected, but the new technology Xcode uses to check if the device is connected doesn't work sometimes.

Also, beforeI ran the CL, I was VNC'd to the bot and I got kicked off. I had to relogin. My ssh terminal had this error:

*** FINAL System shutdown message from flutter-devicelab-mac-23 ***
System going down IMMEDIATELY


F0122 14:00:36.048565       1 helper.go:469] websocket: close 1006 (abnormal closure): unexpected EOF
                                         client_loop: send disconnect: Broken pipe

Maybe the host bot restarted and that caused the device disconnect?

@jmagman
Copy link
Member

jmagman commented Jan 22, 2024

Or do it manually after we see the flake happen?

Manually once to see in the logs if anything weird is going on.

@vashworth
Copy link
Contributor Author

vashworth commented Jan 23, 2024

Okay I went down a rabbit hole with sysdiagnose logs and discovered a pattern.

It seems like occasionally our bots restart after tests.

On startup, it does something with LaunchServices. For example:

2024-01-21 23:49:36.326984-0800 0x4d86     Default     0x0                  1364   2    CoreDeviceService: (LaunchServices) [com.apple.launchservices:db] NotifyToken::RegisterDispatch(user.uid.502.com.apple.LaunchServices.database) fired for session key <private>
2024-01-21 23:49:36.327007-0800 0x4fe2     Default     0x0                  4026   2    Xcode: (LaunchServices) [com.apple.launchservices:db] NotifyToken::RegisterDispatch(user.uid.502.com.apple.LaunchServices.database) fired for session key <private>

However, occasionally on startup, these LaunchServices for CoreDeviceService process doesn't happen. If it doesn't happen, the next test to run will fail with the disconnect issue. In fact, no CoreDeviceService processes will be run until the bot restarts. Then hopefully on startup, it will do the LaunchServices process for CoreDeviceService.

^^ I analyzed 18 restarts (on 2 different bots) and found this to always be true.

I'm not entirely sure what these processes are doing. Perhaps CoreDeviceService is added to the LaunchServices database? Perhaps it needs to be launched? I wonder if it would show in launchctl list?

@jmagman Any insight into LaunchServices and how that works?

@jmagman
Copy link
Member

jmagman commented Jan 25, 2024

I tried to make and sign a com.apple.launchservices logging profile to show the <private> logs but it didn't work, and others say that doesn't work anymore https://forums.developer.apple.com/forums/thread/676706

I see lsregister but I'm not sure exactly what it's registering when the phone connects.

@vashworth
Copy link
Contributor Author

vashworth commented Jan 25, 2024

Since one of the times I was able to recreate this issue, it was fixed by opening QuickTime. I'm adding an automation to open QuickTime with the device to see if it will work as a temporary workaround: https://flutter-review.googlesource.com/c/recipes/+/54460

Seems like it works: https://chromium-swarm.appspot.com/task?id=675b1d295e24b310

@vashworth vashworth self-assigned this Jan 26, 2024
@vashworth
Copy link
Contributor Author

The QuickTime solution appears to be working 🤯 I'll monitor for another day, but I think it fixed the issue

@jmagman
Copy link
Member

jmagman commented Jan 26, 2024

The QuickTime solution appears to be working 🤯 I'll monitor for another day, but I think it fixed the issue

Thanks for figuring out this extremely strange but effective workaround!

@yusuf-goog
Copy link
Contributor

@vashworth This is great! Lets have it bake for a bit and then we can begin the rollout again.

Even if its effective, its a precarious path having these types of workarounds in place. Lets leave this, or another issue open to track rootcause/fix for this.

@jmagman
Copy link
Member

jmagman commented Jan 26, 2024

I also filed an issue with Apple FB13559148 tracked internally at b/322225404

@vashworth
Copy link
Contributor Author

Workaround has successfully worked for a few days now!

As @yusuf-goog requested, I'll leave this open but deprioritize

@vashworth vashworth added P2 Important issues not at the top of the work list and removed P1 High-priority issues at the top of the work list labels Jan 29, 2024
@vashworth vashworth removed their assignment Jan 29, 2024
XuanTung95 pushed a commit to XuanTung95/recipes that referenced this issue Feb 14, 2024
Bug: flutter/flutter#141383, flutter/flutter#141624
Change-Id: I31209c422b3a00ecd0da60ac71ff07c2d2d6ce39
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/54108
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Victoria Ashworth <vashworth@google.com>
XuanTung95 pushed a commit to XuanTung95/recipes that referenced this issue Feb 14, 2024
Bug: flutter/flutter#141383
Change-Id: I7c8f223e460eb58e1ccf4f879903c1da8b574619
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/54162
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Commit-Queue: Victoria Ashworth <vashworth@google.com>
XuanTung95 pushed a commit to XuanTung95/recipes that referenced this issue Feb 14, 2024
…to connect

Bug: flutter/flutter#141383
Change-Id: Ib161ef48b36b8790df6fe84b1ba9124cb43ed4e2
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/54460
Reviewed-by: Keyong Han <keyonghan@google.com>
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Commit-Queue: Victoria Ashworth <vashworth@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list team-infra Owned by Infrastructure team triaged-infra Triaged by Infrastructure team
Projects
None yet
Development

No branches or pull requests

5 participants