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

bevy_animation::animate_targets crashes with "subtract with overflow" if there is an empty curve on AnimationClip #14766

Open
hukasu opened this issue Aug 15, 2024 · 4 comments
Labels
A-Animation Make things move and change over time C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash

Comments

@hukasu
Copy link

hukasu commented Aug 15, 2024

Bevy version

0.14.1

[Optional] Relevant system information

SystemInfo { os: "Linux 24.05 NixOS", kernel: "6.6.45", cpu: "Intel(R) Core(TM) i7-14700KF", core_count: "20", memory: "31.2 GiB" }
AdapterInfo { name: "NVIDIA GeForce RTX 4060 Ti", vendor: 4318, device: 10243, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "550.78", backend: Vulkan }

What you did

Created an AnimationClip and added a curve to it with empty keyframe_timestamps and keyframes and attempted to play the clip.

What went wrong

Application crashed with "attempted to subtract with overflow", preferably it should warn that the VariableCurve was created with empty keyframe_timestamps and keyframes over crashing.

Additional information

Crash log, a bit mangled because there is multiple errors being printed in parallel

thread 'thread 'thread 'thread 'Compute Task Pool (16)Compute Task Pool (14)Compute Task Pool (15)Compute Task Pool (12)' panicked at ' panicked at ' panicked at ' panicked at /home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rsthread 'thread '/home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs/home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs/home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs:Compute Task Pool (18)Compute Task Pool (10):::131thread '' panicked at Compute Task Pool (9)' panicked at 131131131:/home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs' panicked at /home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs:::/home/hukasu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_animation-0.14.1/src/lib.rs:292929:131:
:
:
:131:attempt to subtract with overflow29131attempt to subtract with overflowattempt to subtract with overflow29:
:
:

29note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
:
attempt to subtract with overflow29:
attempt to subtract with overflow
:
attempt to subtract with overflow
attempt to subtract with overflow

Encountered a panic in system `bevy_animation::animate_targets`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
thread '<unnamed>' panicked at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/local.rs:260:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)

Screenshot_20240815_162609

@hukasu hukasu added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 15, 2024
@mweatherley
Copy link
Contributor

Theoretically fixed by #13105 if it gets merged.

@hukasu
Copy link
Author

hukasu commented Aug 15, 2024

Just a little more info, I was migrating this code from 0.12 to 0.14.1 today, and this did not used to happen on 0.12, i pulled the version from before starting the migration and confirmed that in 0.12 this did not happen.

@alice-i-cecile alice-i-cecile added P-Crash A sudden unexpected crash A-Animation Make things move and change over time and removed S-Needs-Triage This issue needs to be labelled labels Aug 15, 2024
@hukasu
Copy link
Author

hukasu commented Sep 2, 2024

@hukasu
Copy link
Author

hukasu commented Sep 3, 2024

with @mweatherley 's pull request, the curve properly requests 2 or more samples

https://github.com/hukasu/bevy/blob/0f509e1af5ccc8c2a8f05e8aa590fc279dcfe203/tests/empty_variable_curve.rs#L22-L98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

3 participants