Description
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:
- Make sure you're on the linked commit
./copy_assets.sh
. This just copies the one image 127 times.cargo run --features preprocess
- Configure the Xcode project to use your certificate. It might just do this automatically.
- Run from Xcode (or with the Makefile, but I haven't tested that)