maestro icon indicating copy to clipboard operation
maestro copied to clipboard

[1.34.1] MaestroDriverStartupException$IOSDriverTimeoutException

Open nicolas-acl opened this issue 2 years ago • 39 comments
trafficstars

Describe the bug The issue occurs when running a Flow.

To Reproduce Steps to reproduce the behavior :

  1. Start the simulator
  2. Run maestro test ./flows // (flows is a folder with all my .yml)
  3. The Flow fails at Maestro iOS driver did not start up in time.

Expected behavior The error is not occurs

Screenshots maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:476) at maestro.drivers.IOSDriver.open(IOSDriver.kt:65) at maestro.Maestro$Companion.ios(Maestro.kt:585) at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:309) at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:154) at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:82) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:81) at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:37) at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74) at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:81) at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58) at maestro.cli.command.TestCommand.call(TestCommand.kt:136) at maestro.cli.command.TestCommand.call(TestCommand.kt:46) at picocli.CommandLine.executeUserObject(CommandLine.java:1933) at picocli.CommandLine.access$1200(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332) at picocli.CommandLine$RunLast.handle(CommandLine.java:2326) at picocli.CommandLine$RunLast.handle(CommandLine.java:2291) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159) at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22) at picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:117)

Environment information (please complete the following information):

  • Maestro version 1.34.1
  • Platform: iOS 17.0.1
  • Framework: React Native
  • Device model and OS version: iPhone14
  • Simulator
  • Host Mac M1 Pro
  • Mac OS Sonoma 14.1 (23B74)

Additional context

After many attempts, it freezes the simulator.

nicolas-acl avatar Nov 10 '23 15:11 nicolas-acl

up, same problem

julienqueffelec avatar Nov 17 '23 10:11 julienqueffelec

Same, this does not repro on 1.34.0, so it looks to be a regression in the 1.34.1 release

danielbyondd avatar Nov 17 '23 23:11 danielbyondd

Same problem here with maestro 1.34.1

fabiobhz avatar Nov 20 '23 09:11 fabiobhz

Same, this does not repro on 1.34.0, so it looks to be a regression in the 1.34.1 release

Actually, I have the same issue with the 1.34.0 version. I just tried it.

nicolas-acl avatar Nov 20 '23 10:11 nicolas-acl

I faced the same problem when running Maestro on CI. It went away when I increased the driver's timeout from 15s to 60s. The following is from the Maestro docs on how to do this: https://maestro.mobile.dev/advanced/configuring-maestro-driver-timeout

export MAESTRO_DRIVER_STARTUP_TIMEOUT=60000 # setting 60 seconds
maestro test file.yaml

yuseiatlas avatar Nov 22 '23 11:11 yuseiatlas

I faced the same problem when running Maestro on CI. It went away when I increased the driver's timeout from 15s to 60s. The following is from the Maestro docs on how to do this: https://maestro.mobile.dev/advanced/configuring-maestro-driver-timeout

export MAESTRO_DRIVER_STARTUP_TIMEOUT=60000 # setting 60 seconds
maestro test file.yaml

Thanks, but I already try that too. It doesn't change, same error : maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time

nicolas-acl avatar Nov 23 '23 08:11 nicolas-acl

has a work around here been found? this is preventing us from running iOS 17 with maestro

aherrick avatar Dec 20 '23 17:12 aherrick

I'm having this exact issue. For reference, I'm trying to run maestro from crontab using the .zsh profile and ~/.maestro/bin/maestro

Works fine when run manually but that doesn't exactly help our automation

jacobsapps avatar Jan 05 '24 11:01 jacobsapps

same problem... v1.35.0

shishangx avatar Jan 09 '24 09:01 shishangx

Having this same problem mainly on v1.35.0, this was previously intermittent on v1.34.1.

DavidREntwistle avatar Jan 10 '24 10:01 DavidREntwistle

Same issue on v1.35.0, i run it for 3 times on CI and with delay in between, on 3rd attempt it managed to run

pawrob avatar Jan 24 '24 10:01 pawrob

I'm encountering the same issue with the latest version (1.36.0). I've tried different workarounds, like increasing the timeout or retrying after a delay. The old version (1.33.1) is more stable, although I'm also running into this error from time to time there.

Has any of the devs had a chance to look at this issue? It is already open for over three months.

Update: I've also noticed that Maestro runs more reliably when the Simulator app is visible in the foreground (open -a Simulator).

FelixLisczyk avatar Feb 19 '24 17:02 FelixLisczyk

Same problem... running maestro 1.36.0

I change ios 17.2 to 15.0 and know start

DanilloVidal avatar Feb 22 '24 20:02 DanilloVidal

same here, tried version from 1.33.1 to 1.36.1, java.util.concurrent.TimeoutException: Maestro iOS driver did not start up in time, timeout increased to 2 mins already,

maodd avatar Mar 07 '24 19:03 maodd

Having same problem on v1.36.0:

maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:480)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:596)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:309)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:154)
	at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:82)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:81)
	at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:37)
	at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:81)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:51)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:19)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
	at picocli.CommandLine.access$1200(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at maestro.cli.AppKt.main(App.kt:117)

I've tried many different things but the only way I can get it to work again is to completely restart my mac.


Edit:

I at least found a way to get maestro working again after the iOS Driver error starts, without resorting to restarting the entire computer. It appears that even when maestro is run and/or shutdown correctly, it sometimes leaves stray iOS Driver processes running. I found that maestro starts working again after finding then killing these processes (usually 2):

ps aux | grep maestro
# 92127  /Users/user4934/Library/Developer/CoreSimulator/Devices/AC713017-4F72-7303-5652-498575F61EC3/data/Containers/Bundle/Application/935FA456-B60F-26CE-3B17-BCD2AED7E37B/maestro-driver-iosUITests-Runner.app/maestro-driver-iosUITests-Runner

# 92092  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test-without-building -xctestrun /var/folders/bs/fylysjxs3z9g14bh79r68rqc0000gn/T/AC713017-4F72-7303-5652-498575F61EC3/maestro-driver-ios-config.xctestrun -destination id=AC713017-4F72-7303-5652-498575F61EC3 -derivedDataPath /var/folders/bs/sylysjxs3z9g14bh79r68rqc0000go/T/maestro_xctestrunner_xcodebuild_output3578906104202179615


# Then kill those processes:
kill 92092 92127

Edit:

Here's a one liner to kill the processes more easily:

pgrep -lf maestro | awk '{print $1}' | xargs -r kill

rob4226 avatar Mar 13 '24 01:03 rob4226

After updating iOS 17.4 and Xcode 15.3 in the CI (Codemagic), Maestro now works flawlessly. Not sure of the reason but wanted to share my experience.

AbdulelahHajjar avatar Mar 31 '24 13:03 AbdulelahHajjar

Hi guys, a thing that helped me was to reboot the Mac to the factory setting. I know it is quite an unpopular and drastic solution. However, after that, the Maestro and VS code setup was done in one hour without any trouble.

monilami avatar Apr 02 '24 05:04 monilami

Any updates on this issue. we are facing a similar situation, where we use ios 17.2 device on CI

anas-baadshah avatar Apr 23 '24 15:04 anas-baadshah

Here is my discovery: for some reason, when you are running Maestro under IOS 17.0 or 17.2, when Maestro runs the command xcrun simctl list <deviceID>, it doesn't appear your apps that are running in the background. So, there is a validation on the source code that ensures that the app is opened, but for this reason, it never returns true, and then timeout comes. I found this solution. I made the maestro driver builder my responsibility; I'm building it myself. When I'm building, I'm passing export USE_XCODE_TEST_RUNNER=true, which will move the maestro driver build to your responsibility ( remembering that doing it, you will be responsible for dealing with logs and timeouts ). This is the flow that makes my Maestro work; pretty much everything is made with a script.

Build mastro runner-> Start Maestro driver -> wait until install is completed ( while xcrun simctl get_app_container <device_id> <bundle_id> ) -> launch app ( xcrun simctl launch <device_id> <bundle_id> ) -> build react-native in my case -> maestro test ....

yanguyt avatar May 10 '24 10:05 yanguyt

Hey guys, thanks to all of you for sharing information and sorry for the problems.

It'd be really helpful for us if you also shared the Xcode version and iOS simulator version you use when the error happens, along with Maestro CLI version. Thanks!

bartekpacia avatar Jul 11 '24 12:07 bartekpacia

In my case, the problem was that the proxy did not skip the ::1 address. 截屏2024-07-18 17 59 34

WzDTj avatar Jul 18 '24 10:07 WzDTj

@WzDTj Hey, could you explain this discover in more detail? Thank you.

bartekpacia avatar Jul 18 '24 10:07 bartekpacia

@bartekpacia I need to use some proxy tools to access some websites such as GitHub, Google. So when I saw the error maestro.MaestroDriverStartupException$IOSDriverTimeoutException, I used network tools to check which address timed out.

截屏2024-07-18 18 10 02

After I saw ::1:22087, I realized that I didn’t enable ipv6 support in my proxy tool, so I enabled it.

截屏2024-07-18 18 11 44

It was not connecting directly, but through the proxy. So I excluded ::1 from my proxy and everything worked fine.

截屏2024-07-18 18 13 14

截屏2024-07-18 18 22 31

WzDTj avatar Jul 18 '24 10:07 WzDTj

Also experiencing this issue on macos 14 Github action:

Running on iPhone 15 Pro - iOS 17.5 - B5F24E3B-EF7E-4DB6-8B35-ADBE43527CC1
info Dev server ready
maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:480)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:596)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:309)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:154)
	at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:82)
	at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:81)
	at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:37)
	at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:81)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:136)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:46)
	at picocli.CommandLine.executeUserObject(CommandLine.java:19[33](https://github.com/candlefinance/candle/actions/runs/10029510568/job/27717763903#step:11:34))
	at picocli.CommandLine.access$1200(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at maestro.cli.AppKt.main(App.kt:117)
	```

gtokman avatar Jul 21 '24 15:07 gtokman

Also experiencing this issue on macos 14 Github action:

@gtokman Did you manage to find a workaround? This is stopping me from using Maestro for our end-to-end tests in Github Actions. Very unfortunate..

andreped avatar Aug 14 '24 19:08 andreped

Hello I still encounter this issue on 1.37.9 on iOS I even tried to revert to older versiosn but i still have the timeout, I tried to changed the timeout but no success.

❌ Error: BlockingCoroutine is cancelling
kotlinx.coroutines.JobCancellationException: BlockingCoroutine is cancelling; job=BlockingCoroutine{Cancelling}@3cf3acf8
Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:329)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:162)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:87)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

ahervieuxgirard avatar Aug 21 '24 13:08 ahervieuxgirard

If it would be helpful to have a public repo demonstrating it, here is:

I'm continuing to try troubleshooting steps above to see if I can fix it.

UPDATE: I was able to fix this error on my work project by:

  1. Increasing the MAESTRO_DRIVER_STARTUP_TIMEOUT to 60000, and
  2. increasing the size of the GitHub Actions runner to macos-latest-xlarge

(Unfortunately I can't easily test that on the sample project above because my personal GitHub Actions account isn't paid.)

CodingItWrong avatar Aug 22 '24 17:08 CodingItWrong

I'm encountering this issue on version 1.37.9 for iOS. On my last five runs, it happened two times.

mZargarpur avatar Aug 22 '24 19:08 mZargarpur

We are also facing this issue in our Bitrise CI environment, currently using version 1.37.9.

❌ Error: BlockingCoroutine is cancelling
kotlinx.coroutines.JobCancellationException: BlockingCoroutine is cancelling; job=BlockingCoroutine{Cancelling}@51deb97f
Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:330)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:163)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:88)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)

alberto-jolt avatar Aug 26 '24 01:08 alberto-jolt

Same issue with 1.37.9.

Macos: 13.6.9 Xcode: 15.2

Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
❌ Error: BlockingCoroutine is cancelling
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:330)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:163)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:88)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
Error: Process completed with exit code 1.

thinhv avatar Aug 29 '24 03:08 thinhv