Bug 1815270

Summary: Gazebo crashes on Fedora 31
Product: [Fedora] Fedora Reporter: Michał Rokita <mrokita>
Component: gazeboAssignee: Rich Mattes <richmattes>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 31CC: logans, mrokita, richmattes, robotics
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-18 18:40:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
QPA workaround none

Description Michał Rokita 2020-03-19 20:29:13 UTC
Error message:
terminate called after throwing an instance of 'gazebo::common::Exception'
AL lib: (WW) alcCloseDevice: Releasing context 0x563d9c1feb70
AL lib: (WW) alcSetError: Error generated on device (nil), code 0xa002

F31 on ThinkPad x260 (Intel Core i7-6600U @ 4x 3.4GHz, Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2))

Comment 1 Scott K Logan 2020-03-19 21:04:14 UTC
I'm seeing the same behavior.

I'm fairly confident that these reports are the same issue:
https://retrace.fedoraproject.org/faf/reports/2745154/
https://retrace.fedoraproject.org/faf/reports/2824832/

Comment 2 Rich Mattes 2020-03-20 23:11:51 UTC
Running with --verbose gets:

[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:132]  Unable to create the rendering window
[Err] [WindowManager.cc:139] EXCEPTION: Unable to create the rendering window

Unfortunately gazebo is swallowing the underlying OGRE exception when it can't create the rendering window, I'll try to see what is happening underneath.

Comment 3 Rich Mattes 2020-03-21 00:29:47 UTC
I updated the code responsible for the output above to write the exception text as part of the error message:

[Err] [WindowManager.cc:132]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): Invalid parentWindowHandle (wrong server or screen) in GLXWindow::create at /builddir/build/BUILD/ogre-1.9.0/RenderSystems/GL/src/GLX/OgreGLXWindow.cpp (line 240)

It looks like it's an OGRE/Wayland issue.  I found a similar error report from rviz here:
https://github.com/ros-visualization/rviz/issues/1442

The work-around listed in the bug report works, and gazebo launches properly:
QT_QPA_PLATFORM=xcb gazebo

One way forward is to force gazebo to use xcb platform.  I'll see if there's a way to do that in code so you don't have to use the environment variable.

Comment 4 Rich Mattes 2020-03-26 03:15:05 UTC
Created attachment 1673680 [details]
QPA workaround

Comment 5 Rich Mattes 2020-03-26 03:15:22 UTC
Reported upstream at https://bitbucket.org/osrf/gazebo/issues/2704/gazebo-fails-to-launch-under-wayland

I haven't been able to figure out how to override the QPA without an environment variable.  We could set the environment variable via the gazebo.desktop launcher, but that would only work when launching gazebo from the GUI, and wouldn't apply when launching from the CLI.  Given that the 'gazebo' executable is launching 'gzserver' and 'gzclient' via 'execvp', we can work around the problem by changing the execvp call for 'gzclient' to execvpe, and supply a modified set of environment variables with the QT_QPA_PLATFORM override appended to the existing environment variables.  It would let you launch 'gazebo' from the cli and from the gui, but launching 'gzclient' from the cli would still require the QPA override.  The attached patch implements this workaround, and works on my machine.  It's not great, but I can add it as a workaround for now.

Comment 6 Rich Mattes 2020-04-18 18:40:30 UTC

*** This bug has been marked as a duplicate of bug 1816487 ***