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

On iOS, loading many assets in AssetMode::Processed causes some assets to fail to load #14542

Open
Seldom-SE opened this issue Jul 30, 2024 · 2 comments · May be fixed by #17377
Open

On iOS, loading many assets in AssetMode::Processed causes some assets to fail to load #14542

Seldom-SE opened this issue Jul 30, 2024 · 2 comments · May be fixed by #17377
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior O-iOS Specific to the iOS mobile operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@Seldom-SE
Copy link

Bevy version

0.14.0

Relevant system information

iOS 17.5.1

What you did

Loaded 128 images all at once with AssetMode::Processed in iOS. The images aren't preprocessed, they're just configured to be copied into imported_assets.

What went wrong

5 of the assets failed to load with �[2m2024-07-30T19:31:05.814567Z�[0m �[31mERROR�[0m �[2mbevy_asset::server�[0m�[2m:�[0m Encountered an I/O error while loading asset: Too many open files (os error 24).

Additional information

I tracked the loading states of the asset with logging:

�[2m2024-07-30T19:31:33.444959Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m == LOAD STATES ==
�[2m2024-07-30T19:31:33.444966Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m no_state   0
�[2m2024-07-30T19:31:33.444970Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m not_loaded 0
�[2m2024-07-30T19:31:33.444975Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m loading    0
�[2m2024-07-30T19:31:33.444980Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m loaded     123
�[2m2024-07-30T19:31:33.444984Z�[0m �[32m INFO�[0m �[2mbevy_mobile_example�[0m�[2m:�[0m failed     5

This issue doesn't occur in AssetMode::Unprocessed with 512 images. I haven't tested with more than that. I suspect there's already a mechanism in Bevy that prevents too many assets from loading all at once, but it doesn't take into account .meta files.

Behold, a repro: https://github.com/Seldom-SE/testetst/blob/279fa27a26bf0b845a5558a815c1f8d031c26fa2/src/lib.rs It's based on bevy_mobile_example. To run it:

  1. Make sure you're on the linked commit
  2. ./copy_assets.sh. This just copies the one image 127 times.
  3. cargo run --features preprocess
  4. Configure the Xcode project to use your certificate. It might just do this automatically.
  5. Run from Xcode (or with the Makefile, but I haven't tested that)
@Seldom-SE Seldom-SE added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 30, 2024
@Seldom-SE Seldom-SE changed the title On iOS, loading many preprocessed assets causes some assets to fail to load On iOS, loading many assets in AssetMode::Processed causes some assets to fail to load Jul 30, 2024
@Seldom-SE
Copy link
Author

Currently working around it by loading our assets in two different states

@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds O-iOS Specific to the iOS mobile operating system and removed S-Needs-Triage This issue needs to be labelled labels Jul 31, 2024
@Braymatter
Copy link
Contributor

Braymatter commented Jan 4, 2025

Confirming this is still an issue in 0.15.1

Interestingly seems to be somehow related to the file_watcher feature, as having file_watch enabled reproduces the issue, but disabling it makes the app load fine.

@BenjaminBrienen BenjaminBrienen added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior O-iOS Specific to the iOS mobile operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
4 participants