godot_openvr: Launching Godot (with ARVR support) Causes Eventual `godot_arvr_process` Seg Fault

I’m running Godot w/ARVR support on Ubuntu (19.04) + HTC Vive (generation 1). The crash pattern is:

  1. Launch Godot w/o controller(s)

  2. Turn on controller, generating the following console output (but Godot will keep running):

    Found openvr device 1 (vr_controller_vive_1_5)
    Creating render model resource
    OpenVR: increased use count to 2
    Argument count: 1
    Searching for: vr_controller_vive_1_5
    
  3. Click controller, causing the following crash:

    handle_crash: Program crashed with signal 11
    Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
    [1] /lib/x86_64-linux-gnu/libc.so.6(+0x43f60) [0x7f89de6b1f60] (??:0)
    [2] /home/george/Simula/addons/godot-openvr/bin/x11/libgodot_openvr.so(+0x2b98) [0x7f89d4abfb98] (??:0)
    [3] ARVRInterfaceGDNative::process() (/home/george/SimulaMax/build/godot/modules/gdnative/arvr/arvr_interface_gdnative.cpp:212)
    [4] ARVRServer::_process() (/home/george/SimulaMax/build/godot/servers/arvr_server.cpp:352 (discriminator 2))
    [5] VisualServerViewport::draw_viewports() (/home/george/SimulaMax/build/godot/servers/visual/visual_server_viewport.cpp:252)
    [6] VisualServerRaster::draw(bool, double) (/home/george/SimulaMax/build/godot/servers/visual/visual_server_raster.cpp:107 (discriminator 2))
    [7] VisualServerWrapMT::draw(bool, double) (/home/george/SimulaMax/build/godot/servers/visual/visual_server_wrap_mt.cpp:104)
    [8] Main::iteration() (/home/george/SimulaMax/build/godot/main/main.cpp:1878)
    [9] OS_X11::run() (/home/george/SimulaMax/build/godot/platform/x11/os_x11.cpp:2959)
    [10] /home/george/Simula/addons/godot-haskell-plugin/../..//bin/godot(main+0xdc) [0x115b82e] (/home/george/SimulaMax/build/godot/platform/x11/godot_x11.cpp:56)
    [11] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f89de694b6b] (??:0)
    [12] /home/george/Simula/addons/godot-haskell-plugin/../..//bin/godot(_start+0x2a) [0x115b69a] (??:?)
    -- END OF BACKTRACE --
    
  4. The fuller gdb backtrace output is as follows:

    Found openvr device 1 (vr_controller_vive_1_5)
    Creating render model resource
    OpenVR: increased use count to 2
    Argument count: 1
    Searching for: vr_controller_vive_1_5
    [New Thread 0x7fffbe195700 (LWP 5188)]
    
    Thread 1 "godot" received signal SIGSEGV, Segmentation fault.
    0x00007fffed32cb98 in godot_arvr_process (p_data=0x61074c0) at src/ARVRInterface.cpp:347
    347    src/ARVRInterface.cpp: No such file or directory.
    (gdb) bt
    #0  0x00007fffed32cb98 in godot_arvr_process(void*) (p_data=0x61074c0)
        at src/ARVRInterface.cpp:347
    #1  0x000000000154e494 in ARVRInterfaceGDNative::process() (this=0x6112190)
        at modules/gdnative/arvr/arvr_interface_gdnative.cpp:211
    #2  0x0000000002df1ac1 in ARVRServer::_process() (this=0x5af5cd0)
        at servers/arvr_server.cpp:356
    #3  0x0000000002fea1a0 in VisualServerViewport::draw_viewports() (this=0x4f207b0)
        at servers/visual/visual_server_viewport.cpp:250
    #4  0x0000000002fbc351 in VisualServerRaster::draw(bool, double)
        (this=0x4f1db60, p_swap_buffers=true, frame_step=0.019463000819087029)
        at servers/visual/visual_server_raster.cpp:106
    #5  0x0000000002ff0bee in VisualServerWrapMT::draw(bool, double)
    
        at servers/visual/visual_server_wrap_mt.cpp:102
    #6  0x000000000119713c in Main::iteration() () at main/main.cpp:1877
    #7  0x000000000116a5c9 in OS_X11::run() (this=0x7fffffffdb20)
        at platform/x11/os_x11.cpp:2959
    #8  0x000000000115b82e in main(int, char**) (argc=3, argv=0x7fffffffe298)
        at platform/x11/godot_x11.cpp:55
    

Someone else on a project I’m working on (@KaneTW) inspected libgodot_openvr with debug symbols and found that

arvr_api->godot_arvr_set_controller_button(arvr_data->trackers[event.trackedDeviceIndex], button, true);

is what is crashing, so that this could be a bug with libgodot_openvr.

Does anyone have any thoughts about how to fix this crash?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Like i said, the p_tracker_id is just a warning that there is an ARVRController set to an ID for which no controller is active. 0 is the default id (or was) so this is most likely caused by the split second where the ARVRController is added for the new controller but its tracker id isn’t set yet.