HxGodot/hxgodot

Squash the creeps demo segfaults on Linux

Closed this issue · 4 comments

Hi,

as discussed on Discord. I'm running Godot 4.0-beta10 on Fedora 36. I'm currently building Godot's master, just in case. Let me know if you need more info.

This is the output of running godot --verbose:

$ Godot_v4.0-beta10_linux.x86_64 --verbose
Godot Engine v4.0.beta10.official.d0398f62f - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
XInput: Refreshing devices.
XInput: No touch devices found.
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Vulkan devices:
  #0: Intel Intel(R) Graphics (ADL GT2) - Supported, Integrated
  #1: NVIDIA NVIDIA RTX A2000 8GB Laptop GPU - Supported, Discrete
  #2: Unknown llvmpipe (LLVM 14.0.0, 256 bits) - Supported, CPU
Vulkan API 1.3.205 - Using Vulkan Device #1: NVIDIA - NVIDIA RTX A2000 8GB Laptop GPU
Optional extension VK_KHR_incremental_present not found
Optional extension VK_GOOGLE_display_timing not found
- Vulkan Variable Rate Shading supported:
  Pipeline fragment shading rate
  Primitive fragment shading rate
  Attachment fragment shading rate, min texel size: (16, 16), max texel size: (16, 16)
- Vulkan multiview supported:
  max view count: 32
  max instances: 134217727
- Vulkan subgroup:
  size: 32
  stages: STAGE_VERTEX, STAGE_TESSELLATION_CONTROL, STAGE_TESSELLATION_EVALUATION, STAGE_GEOMETRY, STAGE_FRAGMENT, STAGE_COMPUTE, STAGE_RAYGEN_KHR, STAGE_ANY_HIT_KHR, STAGE_CLOSEST_HIT_KHR, STAGE_MISS_KHR, STAGE_INTERSECTION_KHR, STAGE_CALLABLE_KHR, STAGE_TASK_NV, STAGE_MESH_NV
  supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_ARITHMETIC, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELATIVE, FEATURE_CLUSTERED, FEATURE_QUAD, FEATURE_PARTITIONED_NV
  quad operations in all stages
Using present mode: VK_PRESENT_MODE_FIFO_KHR
XcursorGetTheme could not get cursor theme
Using present mode: VK_PRESENT_MODE_FIFO_KHR
Using "default" pen tablet driver...
Creating VMA small objects pool for memory type index 1
Shader 'CanvasSdfShaderRD' SHA256: f18a0b2db6d420ae215cec878c172815eb9c8aa664d916e501275c8c61be5256
Shader 'SkeletonShaderRD' SHA256: eac1a807041e8d6c72af2491b6a161f1c2e0891f26d63124ddd49394d4237248
Shader 'ParticlesShaderRD' SHA256: feea25801a10cf2465aeef9d1a726edd27a68249e618b13672ed7d86024b94f2
Shader 'ParticlesCopyShaderRD' SHA256: b48b1c75ce45c5476dffe593796399f27e5892b2069abd66bf4fabf23f32ec80
Shader 'CanvasShaderRD' SHA256: 74b718727b62a16ecc30dc9f0a06f16da09f3b6475a2164075b4afd304a68a1e
Shader 'CanvasOcclusionShaderRD' SHA256: 491c635e8efc1c075ebfce9ab22022575c302aa67967513ff1ddc872f3de8c56
Shader 'ClusterRenderShaderRD' SHA256: 7559adea329b2fee7843db4f05886f04feed38b52f87a5a2e41730ef2d094bdd
Shader 'ClusterStoreShaderRD' SHA256: 0eb28ec61b52da66e912197f89bba87bf286006ab4b20ba7ef1e4fb89387391a
Shader 'ClusterDebugShaderRD' SHA256: 0d279bac7c85b503afca459b71d79a9ce6466365fd97b707c63fce92925b2509
Shader 'SceneForwardClusteredShaderRD' SHA256: e265f8b00e3ec9ae7514780d05a1f517c98f0fa7eea20eaa33f84b177b642ab3
Shader 'ResolveShaderRD' SHA256: bcd93287e3e0757e228c8ea6a173079b100da3020985969773410e736ff0a465
Shader 'TaaResolveShaderRD' SHA256: c45e6618b35164bbdcf2c522c8ea231514714881ed724e289bef4204c76f2f5a
Shader 'SsEffectsDownsampleShaderRD' SHA256: c6afe90890a59b26f8677541ccd28f3ee46441a10c41e50dd909a8a063024383
Shader 'SsilShaderRD' SHA256: 1596713949e26f565e5300c4ade451d261cb0cc41f47a5e99619d5b6fe874729
Shader 'SsilImportanceMapShaderRD' SHA256: bbcd58e59a15824eafb11863194c9571fd094c3b1dfe2fdc62bfd9338b50a678
Shader 'SsilBlurShaderRD' SHA256: 4c90c66ac598adefaa82952eb7066ee27981272ccd241444f137c5191d6b8290
Shader 'SsilInterleaveShaderRD' SHA256: b6984b7fd01598104fe94d85d550fccf3531b3ba4c34c2d8b33ac06baceaf394
Shader 'SsaoShaderRD' SHA256: 97e9b37b831e51703c09993287bf7b3a314371945669616b4e4c3257d30452f7
Shader 'SsaoImportanceMapShaderRD' SHA256: 33c3b7c3b98a4535ffadbc59206b0db16e68c9645f782f04868b7efa635634c4
Shader 'SsaoBlurShaderRD' SHA256: 4c9481349f2104953c3929b0b5637bbd832a98c24adc1bcbfc473e011bd25f21
Shader 'SsaoInterleaveShaderRD' SHA256: befe458b9966aa28865f8ced7e6ea8dd50861bfad52812ddd6e512025a520cd8
Shader 'ScreenSpaceReflectionScaleShaderRD' SHA256: aa04deed69240e85ec3e55e4d4cfd3f81ec6d4730e93815068310d6ec86ed9f8
Shader 'ScreenSpaceReflectionShaderRD' SHA256: 8888b0502ffb8af3405983fae9f43897467034ff0f0436344de50abd4b701291
Shader 'ScreenSpaceReflectionFilterShaderRD' SHA256: bd88c3006d6e5f4582def30a9b98d2f1a3ee4175dd76c4461d02ed849ff8d791
Shader 'SubsurfaceScatteringShaderRD' SHA256: fe68ee4a64d82b987a9c0a212e68613c0cb639986daad63af32d190c3708e0a3
Shader 'SkyShaderRD' SHA256: 90792048383f395a116c2248d0163ba2a324899e94611a98fcebea7daf5c7505
Shader 'VoxelGiShaderRD' SHA256: 6ab3bcc55c237c43f26fe20d45882c1c528d2e73875b0d8da2f90af5b72d9314
Shader 'VoxelGiDebugShaderRD' SHA256: e2015c51bc22829c8e2c2eed1c275fb17111446e694dc78d9ee208509a07aaae
Shader 'SdfgiPreprocessShaderRD' SHA256: 877317a5dac8c8de3686687f1ed48e37d23fd2e3810658ea1238c3750017ec77
Shader 'SdfgiDirectLightShaderRD' SHA256: 3b69ca8b9242958e9d4cdf63061ccdcb0c05796fe6a76419e51a5e6cc005dd09
Shader 'SdfgiIntegrateShaderRD' SHA256: 9b1a08ae85da6e62efbd6c79966f8e935d74ff69aa71ea988ccdd23f4d642704
Shader 'GiShaderRD' SHA256: 41723865a75a88d3a0a606c446c41d8349dd53dc5b2988cd15ccb5f13d993d4c
Shader 'SdfgiDebugShaderRD' SHA256: 8450fc964991caccf59ee7296a00c98caf1c33a6c5cd7f368ea6e372c162e5d4
Shader 'SdfgiDebugProbesShaderRD' SHA256: a3f8a30d54c033eebc54972d22c3d4577fb5190b3eb40bcd12df59d12098dd93
Shader 'VolumetricFogShaderRD' SHA256: 4e3a19210235d49af562be1781755f73b73d9965cdedae5a8696b699deccd8ac
Shader 'VolumetricFogProcessShaderRD' SHA256: 2370c7ae439d2aca4bd0272a4f5a03c713f9f0f1c6395965ed6599fa3fdb058b
Shader 'BokehDofShaderRD' SHA256: 009e057ba8999e8fb1f5a4ee17a497b83c24edfa37e7a2c83ac4cd9f627e7708
Shader 'CopyShaderRD' SHA256: 0998fb3a8bbfb79419a13ed47f87ce7cc692aa9f10c316626f8eaf3179a33fd7
Shader 'CopyToFbShaderRD' SHA256: 8c562c44eb6ca5ebadb84bee894fdf94c930f53bb156882aa00d22ff71cca77a
Shader 'CubeToDpShaderRD' SHA256: 5d0654bf930350a7f1ff0731a20e1bba784c921cfce05b324a32e6603d855205
Shader 'CubemapDownsamplerShaderRD' SHA256: 60c9f3006f64bfd07edccf45c5facbdbc4179c7a663980f2e34a2a6a2e0a9afe
Shader 'CubemapFilterShaderRD' SHA256: bf27411063a3283524fcff41a69137b707209e18ad597692eaef413fa33cf896
Shader 'CubemapRoughnessShaderRD' SHA256: 1c6f17d06064810bec8a569cc4e877650a99d22b6c2025b2278454869c1abf91
Shader 'SpecularMergeShaderRD' SHA256: 6948e58808a654b0da4a1cae4dfeb6182c3dfd40cc8e916f6a95b895d545b5f4
Shader 'TonemapShaderRD' SHA256: e53e76ddd0de4d6ba272c36c504cbfa2ef8c8da4b3f7a4654a2ac4c319ddf9e7
Shader 'VrsShaderRD' SHA256: 6e832f402b8d9f6dee2d5aaee9dba8c84a431635978f21e3bec3d64c2a9f793a
Shader 'FsrUpscaleShaderRD' SHA256: 2108b5939f9d6264f4a2cc745bfadd4c26c0ae7b5ef37d936d754176e9895b0b
Shader 'LuminanceReduceShaderRD' SHA256: ad4ef9db8fd1b87145591ed65bdf6b6c61f9bdde06952b55e2432a1a14dd94b6
Shader 'RoughnessLimiterShaderRD' SHA256: 515f6913b3dcd84c60822f2a1ed7c9f5570398de555d2598350e12e05cd29da8
Shader 'SortShaderRD' SHA256: e0330584b10b0f31652ec669a8ffe98a2d09bcabb654c5ae48a16e6a58a2537f
Shader 'BlitShaderRD' SHA256: 9dc8971185071019519df6245f84eeee6c7768d63abcaf7aa420677019943ad3
JoypadLinux: udev enabled and loaded successfully.
PulseAudio: context other
PulseAudio: context other
PulseAudio: context other
PulseAudio: context ready
PulseAudio: Detecting channels for device: auto_null
PulseAudio: detected 2 output channels
PulseAudio: audio buffer frames: 512 calculated output latency: 11ms
 
TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)".
WARNING: Available builtins: 22
     at: HxGodot:main (HxGodot.hx:51)
WARNING: Available classes: 78
     at: HxGodot:main (HxGodot.hx:61)
CORE API HASH: 3769786914
EDITOR API HASH: 3797293969
Loaded builtin certs

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta10.official (d0398f62f08ce0cfba80990b21c6af4181f93fe9)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x3ea30) [0x7fdb09e3ea30] (??:0)
[2] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x7cb2f) [0x7fdaf167cb2f] (??:0)
[3] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x7cbf4) [0x7fdaf167cbf4] (??:0)
[4] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x48cc99) [0x7fdaf1a8cc99] (??:0)
[5] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x365018) [0x7fdaf1965018] (??:0)
[6] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x3660f3) [0x7fdaf19660f3] (??:0)
[7] /home/jwinkler/Documents/misc/squash-the-creeps-3d-hxgodot/bin/libhxgodot.debug.x86_64.dso(+0x3631ae) [0x7fdaf19631ae] (??:0)
[8] Godot_v4.0-beta10_linux.x86_64() [0x2a5c451] (??:0)
[9] Godot_v4.0-beta10_linux.x86_64() [0x2ec9bfa] (??:0)
[10] Godot_v4.0-beta10_linux.x86_64() [0x43d9424] (??:0)
[11] Godot_v4.0-beta10_linux.x86_64() [0x2a3ac6e] (??:0)
[12] Godot_v4.0-beta10_linux.x86_64() [0x2a5fdc4] (??:0)
[13] Godot_v4.0-beta10_linux.x86_64() [0xe8dfd6] (??:0)
[14] Godot_v4.0-beta10_linux.x86_64() [0xdbfa53] (??:0)
[15] /lib64/libc.so.6(+0x29510) [0x7fdb09e29510] (??:0)
[16] /lib64/libc.so.6(__libc_start_main+0x89) [0x7fdb09e295c9] (??:0)
[17] Godot_v4.0-beta10_linux.x86_64() [0xde127e] (??:0)
-- END OF BACKTRACE --
================================================================
Aborted (core dumped)

Backtrace:

$ gdb Godot_v4.0-beta10_linux.x86_64 
GNU gdb (GDB) Fedora 12.1-2.fc36
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Godot_v4.0-beta10_linux.x86_64...
(No debugging symbols found in Godot_v4.0-beta10_linux.x86_64)
(gdb) run
Starting program: /home/jwinkler/.local/bin/Godot_v4.0-beta10_linux.x86_64 

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.fedoraproject.org/ 
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after vfork from child process 22376]
[New Thread 0x7fffea5ff640 (LWP 22380)]
[New Thread 0x7fffe9dfe640 (LWP 22381)]
[New Thread 0x7fffe95fd640 (LWP 22382)]
[New Thread 0x7fffe8dfc640 (LWP 22383)]
[New Thread 0x7fffe85fb640 (LWP 22384)]
[New Thread 0x7fffe7dfa640 (LWP 22385)]
[New Thread 0x7fffe75f9640 (LWP 22386)]
[New Thread 0x7fffe6df8640 (LWP 22387)]
[New Thread 0x7fffe65f7640 (LWP 22388)]
[New Thread 0x7fffe5df6640 (LWP 22389)]
[New Thread 0x7fffe55f5640 (LWP 22390)]
[New Thread 0x7fffe4df4640 (LWP 22391)]
[New Thread 0x7fffe45f3640 (LWP 22392)]
[New Thread 0x7fffe3df2640 (LWP 22393)]
[New Thread 0x7fffe35f1640 (LWP 22394)]
[New Thread 0x7fffe2df0640 (LWP 22395)]
[New Thread 0x7fffe25ef640 (LWP 22396)]
[New Thread 0x7fffe1dee640 (LWP 22397)]
[New Thread 0x7fffe15ed640 (LWP 22398)]
[New Thread 0x7fffe0dec640 (LWP 22399)]
[New Thread 0x7fffe05eb640 (LWP 22400)]
Godot Engine v4.0.beta10.official.d0398f62f - https://godotengine.org
[New Thread 0x7fffd16be640 (LWP 22411)]
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Vulkan API 1.3.205 - Using Vulkan Device #1: NVIDIA - NVIDIA RTX A2000 8GB Laptop GPU
[New Thread 0x7fffd0d3d640 (LWP 22413)]
[New Thread 0x7fffcbfff640 (LWP 22414)]
[New Thread 0x7fffc8e80640 (LWP 22422)]
[New Thread 0x7fffc3dff640 (LWP 22423)]
[New Thread 0x7fffc35fe640 (LWP 22424)]
[New Thread 0x7fffc2a8b640 (LWP 22425)]
 
[New Thread 0x7fffc228a640 (LWP 22426)]
WARNING: Available builtins: 22
     at: HxGodot:main (HxGodot.hx:51)
WARNING: Available classes: 78
     at: HxGodot:main (HxGodot.hx:61)

Thread 1 "Godot_v4.0-beta" received signal SIGSEGV, Segmentation fault.
0x00007fffdf47cb2f in hx::StackContext::popFrame (this=0x0, inFrame=0x7fffffffcb20) at /home/jwinkler/.local/share/haxe/lib/hxcpp/4,2,1/include/hx/StackContext.h:508
508	      if (mIsUnwindingException)
(gdb) bt
#0  0x00007fffdf47cb2f in hx::StackContext::popFrame (this=0x0, inFrame=0x7fffffffcb20)
    at /home/jwinkler/.local/share/haxe/lib/hxcpp/4,2,1/include/hx/StackContext.h:508
#1  0x00007fffdf47cbf4 in hx::StackFrame::~StackFrame (this=0x7fffffffcb20, __in_chrg=<optimized out>)
    at /home/jwinkler/.local/share/haxe/lib/hxcpp/4,2,1/include/hx/StackContext.h:673
#2  0x00007fffdf88cc99 in godot::CharacterBody3D_obj::get_slide_collision_count (this=0x7fffdfd14a74) at ./src/godot/CharacterBody3D.cpp:631
#3  0x00007fffdf765018 in stc::HxPlayer_obj::_physics_process (this=0x7fffdfd14a74, _delta=0.016666666666666666) at ./src/stc/HxPlayer.cpp:429
#4  0x00007fffdf7660f3 in stc::HxPlayer_obj::virtual_HxPlayer__physics_process (this=0x7fffdfd14a74, _args=0x7fffffffceb0, _ret=0x0)
    at ./src/stc/HxPlayer.cpp:575
#5  0x00007fffdf7631ae in virtual_HxPlayer__physics_process__onVirtualCall (p_instance=0xb478000, p_args=0x7fffffffceb0, r_ret=0x0)
    at ./src/stc/HxPlayer.cpp:138
#6  0x0000000002a5c451 in ?? ()
#7  0x0000000002ec9bfa in ?? ()
#8  0x00000000043d9424 in ?? ()
#9  0x0000000002a3ac6e in ?? ()
#10 0x0000000002a5fdc4 in ?? ()
#11 0x0000000000e8dfd6 in ?? ()
#12 0x0000000000dbfa53 in ?? ()
#13 0x00007ffff7c29510 in __libc_start_call_main () from /lib64/libc.so.6
#14 0x00007ffff7c295c9 in __libc_start_main_impl () from /lib64/libc.so.6
#15 0x0000000000de127e in ?? ()
(gdb) 

Same behavior on current Godot master (b29bb11a4c).

Removing the for loop in HxPlayer.hx:90 lets me run the demo, but any input results in a similar crash:

(gdb) bt
#0  0x00007fffdf47cb2f in hx::StackContext::popFrame (this=0x0, inFrame=0x7fffffffcec0)
    at /home/jwinkler/.local/share/haxe/lib/hxcpp/4,2,1/include/hx/StackContext.h:508
#1  0x00007fffdf47cbf4 in hx::StackFrame::~StackFrame (this=0x7fffffffcec0, __in_chrg=<optimized out>)
    at /home/jwinkler/.local/share/haxe/lib/hxcpp/4,2,1/include/hx/StackContext.h:673
#2  0x00007fffdf8ca71c in godot::InputEvent_obj::_hx____binding_reference_callback (_token=0x78c1c10, _binding=0xc741170, _reference=false)
    at ./src/godot/InputEvent.cpp:527
#3  0x00007fffdf8ce2d2 in godot::InputEvent_obj::___binding_reference_callback (p_token=0x78c1c10, p_instance=0xc741170, p_reference=0 '\000')
    at include/godot/InputEvent.h:158
#4  0x00000000043ff9e2 in ?? ()
#5  0x00000000041e008b in ?? ()
#6  0x0000000000e43bdd in ?? ()
#7  0x0000000000dbfa42 in ?? ()
#8  0x00007ffff7c29510 in __libc_start_call_main () from /lib64/libc.so.6
#9  0x00007ffff7c295c9 in __libc_start_main_impl () from /lib64/libc.so.6
#10 0x0000000000de127e in ?? ()

I found the issue but uncovered a few more bugs. If you want, you can test this branch here: https://github.com/dazKind/hxgodot-cpp/tree/fix-stack

The game should start and play a lot more stable until a point when the GC of a RefCounted InputEvent fails.

Just merged some fixes for this. Linux & Macos x86_64 Vulkan should work now :)