-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Crash with adding/removing AnimationLibraries and trying to play an animation #86691
Comments
I am having the same issue randomly when calling animationPlayer.GetAnimationLibrary("").RemoveAnimation(.... and then latter recreating a new animation, or the same with animationPlayer.GetAnimationLibrary("").AddAnimation(. In my case is because some events share the same scene animationPlayer and i set in that animationPlayer all animations... Really difficult to reproduce because i am not sure what is happening, animationPlayer is not null and animation exists in the library. Crash message in C# (StopAnimation returns the same error) Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. |
Set the Stop before removing the library seems to work for me too. So even if we do not Play, it does something with that library when asigned animationPlayer.Stop(); |
I have been going through a similar issue and have created a test project to reproduce it using GDScript. Test Project Steps To Reproduce |
just ran into exactly this on a personal project 4.3-rc1 and 4.3-rc2 both crash in the same way when doing too many operations with animation libraries. Running on windows 10, gdscript version (not the mono build) |
Godot 4.3 rc1 and rc2 - Windows 10 - gdscript My project was doing the following:
That was causing this crash with
So I tried
same crash then I tried
same crash in all the above mentioned strategies for dealing with this, it worked fine between 1 to 3 times, then it would crash (likely due to the protected memory access error mentioned by the OP, the gdscript version crashes with no specific error, just exit with signal 11 - running with verbose also shows no specific error, building a binary myself without the production flag also shows no specific errors) I added a bunch of logs to try to pinpoint the exact line where the crash happens, for me it was when calling Then I went a step further and did workaround: for my use case, I could switch from using an animation player to doing everything with tweens, and then no more crashes, might be something that works in a pinch for others too |
Exactly same crash when adding/removing animations from AnimationLibrary (Godot v.4.3.stable, Windows 7, GdScript). Error:
|
I can reproduce the issue in the latest MRP from the OP with only GDScript: TestAnimLibs.zip Stacktrace:
And I can also reproduce the crash from the other MRP in #86691 (comment). Took a bit of back and forth, clicking LMB/RMB rapidly to change the animation and going left and right to change the animation library at the same time. Stacktrace:
CC @TokageItLab |
Tested versions
4.2.1 stable mono, 4.2.1 (standard non-mono version).
System information
Windows 11 - Vulkan - Nvidia RTX 4070 - intel i5 13600KF
Issue description
In my project when I try to load animation library on the fly and then play animation I get random crashes with errors as below. Sometimes animation plays couple times and then crashes and sometimes it crashes immediately.
Step by step what I do:
Nothing else is happening in my project currently, no other code, everything running on the main thread, I tried async and await a frame for things to settle down but it makes no difference.
I can stress enough the part that there're no animations in the animation player and no animations are playing when I press the button there's nothing else in the project, which makes this next step strange.
If before removing and adding animation library to the animation player I call animPlayer.Stop() then I get no errors and no crashes but it makes no sense since as I mentioned I do not have any animations playing, no animations are in the animation player to begin with and I also have an if check just in case animation player was playing to return early and not do anything.
In the test project I've removed all the guards and such to keep everything to the minimum, also it's difficult to reproduce with MRP you might need to keep trying for a while, it's easier to reproduce in C# build that's why this demo has both
main.gd
as well asmain.cs
, I did crash the gdscript version too but it took a lot of time, C# is easier to crash (though it still takes more time).(my animation libraries are a lot larger in my project so chances are that since the MRP library is so small everything happens quickly thus it's more difficult to find the timing for the error while in my project it happens all the time, I can barely play more than 3 animations in succession without crashing.
GDscript version crashes with no error, I also tried
--verbose
mode but gdscript version still gave nothing just silently crashed but it might be a different issue or a combined one, I noticed that when trying to play an animation and then unfocusing window play (moving it) it can cause crash too but without any error messages I can't determine if this is the same issue or not that's why again I'm providing both gdscript and C# scripts.Error message:
I cannot share my animations from my project since these are under a non-open license but I converted them into godot resources (tres) directly and I can reproduce this issue with the MRP which has an animation from inside godot so the issue is not within my animation files.
It can take quite a while to trigger this until you get the hang of it then it's pretty easy, spam that 1 button as much as possible.
I purpously removed all the guards in the MRP to make it easier to trigget, I understand it's not a good idea to remove an animation library while an animation is playing but it's really difficult to put together the MRP for this, in my project I have all the guards up and more actually, I triple checked none of them break everytime I test this.
Steps to reproduce
(5. Drop the main.cs project from the Main node and attach main.gd to the project and go back to step 1)
Minimal reproduction project (MRP)
TestAnimLibs.zip
EDIT: I also tried awaiting
caches_cleared
(called it before),animation_finished
,animation_libraries_updated
but it did nothing apart from that it never stopped waiting.The text was updated successfully, but these errors were encountered: