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

Godot mono - Crash on app shutdown: Condition "!rc_owner" is true. OR signal 11 on MacOS #89188

Closed
Serotonindude opened this issue Mar 5, 2024 · 4 comments · Fixed by #92201

Comments

@Serotonindude
Copy link

Serotonindude commented Mar 5, 2024

Tested versions

  • Reproducible: Godot Mono 4.0.stable, 4.1.3.stable, 4.2.1.stable (currently using this one), 4.2.2.RC1, 4.3.0.dev4

System information

Godot v4.2.1.stable.mono - macOS 14.1.2 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)

Issue description

Hi,
in the beginning I didn't have an issue. Two weeks ago I added an AudioStream array with 14 music tracks to my Music.cs.
Immediately the app started to crash when I close it using CMD+Q or GetTree().Quit().

When I start it from within the Godot Editor, short after closing the app, MacOS will inform me about the crash about half of the times.
When I start it from within VSCode it always hangs on closing. When I switch back to VSCode I usually see:

ERROR: FATAL: Condition "!rc_owner" is true.
   at: _instance_binding_reference_callback (modules/mono/csharp_script.cpp:1379)

Sometimes I see something like this:

===============================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.1.stable.mono.official (b09f793f564a6c95dc76acc654b390e68441bd01)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] invoke_previous_action(sigaction*, int, __siginfo*, void*, bool)
[2] 2   libsystem_platform.dylib            0x0000000183d6ba24 _sigtramp + 56
[3] Object* ClassDB::creator<MobileVRInterface>()
[4] Object::can_translate_messages() const
[5] AnimationMixer::_get_animation_list() const
[6] TileSetScenesCollectionSource::get_scene_tile_id(int)
[7] TileSetScenesCollectionSource::get_scene_tile_id(int)
[8] TileSetScenesCollectionSource::get_scene_tile_id(int)
[9] RendererCompositorRD::_create_current()
[10] RendererCompositorRD::_create_current()
[11] 11  dyld                                0x00000001839c10e0 start + 2360
-- END OF BACKTRACE --
================================================================

Sometimes it's something else.

Interestingly, when I remove my Music.cs altogether it also crashes now. But the project is much bigger now. So I guess it's gotta do something with memory complexity. It also crashes with "Condition "!rc_owner" is true." or alternatively with:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.1.stable.mono.official (b09f793f564a6c95dc76acc654b390e68441bd01)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] invoke_previous_action(sigaction*, int, __siginfo*, void*, bool)
[2] 2   libsystem_platform.dylib            0x0000000183d6ba24 _sigtramp + 56
[3] Object* ClassDB::creator<MobileVRInterface>()
[4] Object::can_translate_messages() const
[5] JSON::get_data() const
[6] JSON::get_data() const
[7] RendererCompositorRD::_create_current()
[8] RendererCompositorRD::_create_current()
[9] 9   dyld                                0x00000001839c10e0 start + 2360
-- END OF BACKTRACE --
================================================================

I tried it with different versions of Godot4 on MacOS... It's consistent.
There's no Problem on Windows 11 though (Godot v4.2.1.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.4633) - 13th Gen Intel(R) Core(TM) i5-13600K (20 Threads))

It's probably related to #77305

Steps to reproduce

  1. Create an empty scene with a C# script which takes an array of about 14 AudioStream objects and populate them with audio data which is about 500MB.
  2. Start the app.
  3. Close the app.
  4. See it crash.

Minimal reproduction project (MRP)

I zipped a project with just one scene, one Music.cs and the 14 audio tracks which reproduces the problem. Unfortunately it's about 500Mb and it contains assets I bought in the unity asset store. So if you need it, I could give someone a link per DM, but I can't put the link here.

@paulloz paulloz added this to the 4.3 milestone Mar 5, 2024
@paulloz paulloz added the crash label Mar 5, 2024
@Serotonindude Serotonindude changed the title Godot mono - Crash on app shutdown: Condition "!rc_owner" is true. OR signal 11 Godot mono - Crash on app shutdown: Condition "!rc_owner" is true. OR signal 11 on MacOS Mar 5, 2024
@fuwaneko
Copy link

System information:
Godot v4.2.1.stable.mono - macOS 14.4.0 - Vulkan (Forward+) - integrated Apple M2 Pro - Apple M2 Pro (10 Threads)

I have a similar issue, although I use Rider instead of VS Code. Running from the Godot editor is fine, but as soon as I try to run exported project or run from within Rider — same issue with crash.

Here's the MRP, it contains only a single CS script, nothing else, and still crashes. Doesn't matter whether to call Quit() in _Input or in _Notification.
crash_mrp.zip

@knightofiam
Copy link

knightofiam commented May 20, 2024

I'm getting a similar crash on macOS Sonoma 14.0. It's in Spine's Godot 4.2.2.stable.mono but I'm not reporting there as this bug already occurs in the standard engine build.

It seems like during input cleanup, a destructor tries to access a dangling pointer to a mouse cursor that was already freed.

ERROR: FATAL: Condition "!rc_owner" is true.
   at: _instance_binding_reference_callback (modules/mono/csharp_script.cpp:1379)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.2.2.stable.mono.custom_build (15073afe3856abd2aa1622492fe50026c7d63dc1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] invoke_previous_action(sigaction*, int, __siginfo*, void*, bool)
[2] 2   libsystem_platform.dylib            0x00007ff80cb6737d _sigtramp + 29
[3] 3   libsystem_c.dylib                   0x00007ff80c9df93b __sfvwrite + 387
[4] CSharpLanguage::_instance_binding_reference_callback(void*, void*, unsigned char) (in Godot) + 283
[5] RefCounted::unreference() (in Godot) + 206
[6] Input::get_default_cursor_shape() const
[7] Input::~Input() (in Godot) + 42
[8] Main::cleanup(bool) (in Godot) + 1079
[9] main (in Godot) + 320
[10] 10  dyld                                0x00007ff80c7b13a6 start + 1942
-- END OF BACKTRACE --
================================================================

I don't think the root issue has anything to with mouse cursors, audio, or styleboxes as in #92076 - they're merely triggering it. Also looks like it's in the macOS-specific code, & probably C# - specific.

Same as @fuwaneko, I'm using JetBrains Rider, and it only crashes when closing the main window from there or the macOS native executable, not from the Godot editor.

@knightofiam
Copy link

knightofiam commented May 20, 2024

Related to #83973, #92076.

@knightofiam
Copy link

knightofiam commented May 20, 2024

Ok, I was able to completely prevent the crash by removing an _UnhandledInput override. Just like #83973, even an empty override triggers the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants