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

Race in macOS between creating bundle and launching it #187

Open
madsmtm opened this issue Sep 10, 2024 · 0 comments
Open

Race in macOS between creating bundle and launching it #187

madsmtm opened this issue Sep 10, 2024 · 0 comments

Comments

@madsmtm
Copy link
Contributor

madsmtm commented Sep 10, 2024

So, this is a bit of a weird one.

I'm using cargo-bundle to launch the Winit examples on Mac Catalyst.

The command I use is:

cargo +nightly bundle --format=ios --target=aarch64-apple-ios-macabi --example=window

And then I run the binary with:

./target/aarch64-apple-ios-macabi/debug/examples/bundle/ios/winit.app/window

All good and fine, except it seems like there is some race-condition inherent between the creation of the binary, and running it, and sometimes the binary would fail to launch properly, and UIKit would throw an error.

I could reproduce it consistently with:

touch ./target/aarch64-apple-ios-macabi/debug/examples/bundle/ios/winit.app && ./target/aarch64-apple-ios-macabi/debug/examples/bundle/ios/winit.app/window

And could no longer reproduce it if I inserted a sleep 2s, either in my code or on the command line.

A bunch of rabbit holes later, I ended up finding all the winit.apps that existed on my system by running open -a winit (I had copied a few of them around), and deleting them; and suddenly everything worked fine again.

So it seems like there's something something launchctl something that keeps track of all application bundles, and that's having trouble with the bundle produced by cargo-bundle?

Idk., posting it here in case I hit the same issue again in a year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant