I am getting a stack overflow error from loading too many animations at once
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
Bevy 0.14.2
## \[Optional\] Relevant system information
using rust 1.81.0, Windows 11
AdapterInfo { name: "NVIDIA GeForce GTX 1070", vendor: 4318, device: 7041, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }
## What you did
I downloaded a model from mixamo with 50 animations and I am trying to load them with the usual method I saw in bevy's examples, but I am getting an error: thread 'IO Task Pool (0)' has overflowed its stack. Here's the part of the code that is causing the problem:
```
let mut graph = AnimationGraph::new();
let animations = graph
.add_clips(
[
GltfAssetLabel::Animation(0).from_asset("Paladin1.glb"),
GltfAssetLabel::Animation(1).from_asset("Paladin1.glb"),
...
GltfAssetLabel::Animation(49).from_asset("Paladin1.glb"),
]
.into_iter()
.map(|path| assets.load(path)), // this seems to be causing the stack overflow, but only when I load too many animations
1.0,
graph.root,
)
.collect();
// Insert a resource with the current scene information
let graph = graphs.add(graph);
commands.insert_resource(Animations {
animations,
graph: graph.clone(),
});
```
## What went wrong
I am getting an error:
Running `target\debug\bevy_test.exe`
2024-09-17T17:43:47.913011Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "Intel(R) Core(TM) i5-9600KF CPU @ 3.70GHz", core_count: "6", memory: "31.9 GiB" }
2024-09-17T17:43:48.052848Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
Failed to open dynamic library "C:\ProgramData\ReShade\.\ReShade64.dll" with error 1114
2024-09-17T17:43:48.053205Z ERROR wgpu_hal::vulkan::instance: objects: (type: INSTANCE, hndl: 0x18d4bbefc00, name: ?)
2024-09-17T17:43:48.241307Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1070", vendor: 4318, device: 7041, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }
2024-09-17T17:43:48.915565Z INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
**thread 'IO Task Pool (0)' has overflowed its stack
error: process didn't exit successfully: `target\debug\bevy_test.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)**
If I try to load only 20 or 30 animations it works just fine, but when I try to load all 50 I get the error.
## Additional information
From my own tests, it seems that the error is triggered by the call of assets.load(). I just tested by just commenting everything else in the code that was unnecessary.
It's actually really easy to reproduce this error. I just modified the animated_fox example to load the mixamo model and all it's animations instead of the fox and that's all it took. I am uploading the model and the modified animated_fox.rs file. Just place the model in the same folder as the `fox` and replace the example file.
[code_and_model.zip](https://github.com/user-attachments/files/17033743/code_and_model.zip)
it's worth noting that I downloaded all animations with 60 fps instead of just 30.
Contributor guide
Assessment
This issue has not been assessed yet.