realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.72k stars 564 forks source link

Timeouts in React Native on iOS/Catalyst Github Actions jobs #4062

Open tomduncalf opened 2 years ago

tomduncalf commented 2 years ago

The React Native on iOS and React Native on Catalyst jobs are frequently timing out on GitHub Actions. It appears to be timing out before the tests actually start running – perhaps it is waiting for the simulator to be ready. I cannot reproduce this locally.

Example: https://github.com/realm/realm-js/runs/4081523233?check_suite_focus=true


Investigation notes for Catalyst:

When the issue occurs, it appears that the app is starting (it appears in the dock), but does not progress beyond that point.

The theory is that since macOS 11, some permissions dialog is popping up (network/local disk/whatever) which prevents the application from starting up properly – e.g. when running the app locally, you sometimes get a firewall popup (but the firewall should be disabled on the GHA runners).

Unfortunately, due to macOS 11's increased security, we have not been able to determine the actual state of the machine at the time when it "freezes" – taking a screenshot e.g. using https://github.com/bencevans/screenshot-desktop results in just a screenshot of the blank desktop (with the RN app icon in the dock), which might mean that nothing is running, but more likely is because with macOS 11, taking a screenshot without the "screen recording" permission results in just a screenshot of the desktop. It's only possible to enable this permission via the System Preferences GUI, and unfortunately it seems GHA have no plan to disable SIP on their macOS image: https://github.com/actions/virtual-environments/issues/650.

Attempting to connect to a runner over VNC using e.g. https://github.com/dakotaKat/fastmac-VNCgui results in a scrambled image, as does trying to record the screen using ffmpeg - presumably another security feature.

One perhaps interesting observation is that if you get the compiled RealmReactNativeTests.app from the runner (e.g. use https://github.com/mxschmitt/action-tmate to access SSH, then run the build, find the resulting .app file in ~/Library/Developer/DerivedData and transfer it to your machine using https://transfer.sh), running it locally results in it doing nothing except showing a dock icon for exactly 60 seconds, then it opens with "no bundle URL present". The app cannot be exited without force quitting.

Parking this for now as the workaround in https://github.com/realm/realm-js/pull/4078 of re-running the tests after a timeout seems to be effective.

sync-by-unito[bot] commented 2 years ago

➤ Tom Duncalf commented:

Parking this as we have a workaround and the investigation was costing a lot of time