Bug 237835 - games/flightgear: fails to start
Summary: games/flightgear: fails to start
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ganael LAPLANCHE
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-11 06:48 UTC by Aaron Farias
Modified: 2019-05-29 15:46 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Farias 2019-05-11 06:48:06 UTC
while trying to run fgfs with Current. I'm getting this error and the program is not responding and is closing down. Don't know why. thank you so much for the help.

Configuration State
============= =====
aircraft-dir = "/usr/local/share/flightgear/Aircraft/c172p"
fghome-dir = "Path "/usr/home/Aaron/.fgfs""
download-dir = "/usr/home/Aaron/.fgfs"
terrasync-dir = "/usr/home/Aaron/.fgfs/TerraSync"
aircraft-search-paths = 
        
scenery-search-paths = 
        /usr/home/Aaron/.fgfs/TerraSync
        /usr/local/share/flightgear/Scenery
[Detaching after fork from child process 3191]
Image loading failed:Warning: reading "/usr/local/share/flightgear/Aircraft/c172p" not supported.
X.Org
AMD SUMO (DRM 2.50.0 / 13.0-CURRENT, LLVM 6.0.1)
3.1 Mesa 18.3.2
1.40
Splash screen progress loading-aircraft-list
[LWP 101228 of process 3190 exited]
[New LWP 101232 of process 3190]
Splash screen progress loading-nav-dat
NavCache at:Path "/usr/home/Aaron/.fgfs/navdata_2018_3.cache"
NavCache read-only flags is:0
NavCache: no main cache rebuild required
Splash screen progress init-scenery
General Initialization
======= ==============
FG_ROOT = "Path "/usr/local/share/flightgear""

Attempting to set starting position for PHNL:04L
Reading timezone info from: Path "/usr/local/share/flightgear/Timezone/zone.tab"
Selected scenery is tilecache
FGStgTerrain::init - init tilemgr
Initializing Tile Manager subsystem.
Initializing the tile cache.
  max cache size = 100
  current cache size = 0
  done with init()
Unable to detect system language
Found language resource for: C
Reading localized strings for 'en' from Path "/usr/local/share/flightgear/Translations/default/sys.xml"
Reading localized strings for 'en' from Path "/usr/local/share/flightgear/Translations/default/atc.xml"
Reading localized strings for 'en' from Path "/usr/local/share/flightgear/Translations/default/tips.xml"
Using default download dir: Path "/usr/home/Aaron/.fgfs"
read-allowed path not found:Path "/usr/home/Aaron/.fgfs/AI"
read-allowed path not found:Path "/usr/home/Aaron/.fgfs/Liveries"
Using TerraSync dir: Path "/usr/home/Aaron/.fgfs/TerraSync"
EmbeddedResourceManager: selected locale ''
Using stock OSG implementation of GraphicsWindow
StatsHandler::StatsHandler() Setting up GL2 compatible shaders
initializing cloud layers
[New LWP 101230 of process 3190]
[New LWP 101231 of process 3190]
Enabling ATI/AMD viewport hack
Configuration State
============= =====
aircraft-dir = "/usr/local/share/flightgear/Aircraft/c172p"
fghome-dir = "Path "/usr/home/Aaron/.fgfs""
download-dir = "/usr/home/Aaron/.fgfs"
terrasync-dir = "/usr/home/Aaron/.fgfs/TerraSync"
aircraft-search-paths = 
        
scenery-search-paths = 
        /usr/home/Aaron/.fgfs/TerraSync
        /usr/local/share/flightgear/Scenery
[Detaching after fork from child process 3191]
Image loading failed:Warning: reading "/usr/local/share/flightgear/Aircraft/c172p" not supported.
X.Org
AMD SUMO (DRM 2.50.0 / 13.0-CURRENT, LLVM 6.0.1)
3.1 Mesa 18.3.2
1.40
Splash screen progress loading-aircraft-list
[LWP 101228 of process 3190 exited]
[New LWP 101232 of process 3190]
Splash screen progress loading-nav-dat
NavCache at:Path "/usr/home/Aaron/.fgfs/navdata_2018_3.cache"
NavCache read-only flags is:0
NavCache: no main cache rebuild required
Splash screen progress init-scenery
General Initialization
======= ==============
FG_ROOT = "Path "/usr/local/share/flightgear""

Attempting to set starting position for PHNL:04L
Reading timezone info from: Path "/usr/local/share/flightgear/Timezone/zone.tab"
Selected scenery is tilecache
FGStgTerrain::init - init tilemgr
Initializing Tile Manager subsystem.
Initializing the tile cache.
  max cache size = 100
  current cache size = 0
  done with init()
Splash screen progress finalize-position
Splash screen progress creating-subsystems
Creating Subsystems
======== ==========
Reading materials from /usr/local/share/flightgear/Materials/regions/materials.xml
Reading systems from Path "/usr/local/share/flightgear/Aircraft/c172p/Systems/systems.xml"
Initializing HUD Instrument
Reading sound sound from Path "/usr/local/share/flightgear/Aircraft/c172p/c172-sound.xml"
Creating subsystems took:3679
Splash screen progress binding-subsystems
[LWP 101232 of process 3190 exited]
[New LWP 101233 of process 3190]
FGPropertyManager::GetNode() No node found for hydro/active-norm
[New LWP 101234 of process 3190]
[New LWP 101235 of process 3190]
[New LWP 101236 of process 3190]
[New LWP 101237 of process 3190]
[New LWP 101238 of process 3190]
ignoring unknown axis-alignment'yx-plane'.
ignoring unknown axis-alignment'yx-plane'.
ignoring unknown axis-alignment'yx-plane'.
[New LWP 101239 of process 3190]
[New LWP 101240 of process 3190]
[LWP 101233 of process 3190 exited]
[New LWP 101241 of process 3190]
Volcanic activity off.
KMA20 audio panel initialized
Hobbs system stopped
Hobbs system stopped
Starter off
KI266 dme indicator #0 initialized

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000000080195c464 in ?? () from /usr/local/lib/libudev.so.0
Comment 1 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-05-16 11:28:27 UTC
Hi,

Just a word to let you know that I am working on it.

I managed to reproduce the problem and got a backtrace :

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000008020631bf in udev_list_RB_MINMAX (head=0x10, val=-1) at udev-list.c:163
163     udev-list.c: No such file or directory.
(gdb) bt
#0  0x00000008020631bf in udev_list_RB_MINMAX (head=0x10, val=-1) at udev-list.c:163
#1  0x000000080206332a in udev_list_entry_get_first (ul=0x10) at udev-list.c:112
#2  0x0000000802061880 in udev_device_get_sysattr_value (ud=0x0, sysattr=0x158e30a "name") at udev-device.c:219
#3  0x0000000000782545 in FGLinuxEventInput::postinit (this=0x82382ab40) at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Input/FGLinuxEventInput.cxx:485
#4  0x00000000011a7e62 in std::__1::__function::__func<SGSubsystemGroup::postinit()::$_1, std::__1::allocator<SGSubsystemGroup::postinit()::$_1>, void (SGSubsystem*)>::operator()(SGSubsystem*&&) ()
#5  0x00000000011a1539 in SGSubsystemGroup::postinit() ()
#6  0x00000000011a7e62 in std::__1::__function::__func<SGSubsystemGroup::postinit()::$_1, std::__1::allocator<SGSubsystemGroup::postinit()::$_1>, void (SGSubsystem*)>::operator()(SGSubsystem*&&) ()
#7  0x00000000011a1539 in SGSubsystemGroup::postinit() ()
#8  0x00000000011a4774 in SGSubsystemMgr::postinit() ()
#9  0x0000000000ee8f2e in fgPostInitSubsystems () at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Main/fg_init.cxx:1034
#10 0x0000000000f11449 in fgIdleFunction () at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Main/main.cxx:350
#11 0x0000000000e7a659 in fgOSMainLoop () at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Viewer/fg_os_osgviewer.cxx:310
#12 0x0000000000f12925 in fgMainInit (argc=1, argv=0x7fffffffe978) at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Main/main.cxx:619
#13 0x0000000000487e4d in main (argc=1, argv=0x7fffffffe978) at /usr/ports/games/flightgear/work/flightgear-2018.3.2/src/Main/bootstrap.cxx:339

The problem is located in FGLinuxEventInput::postinit() :

467 void FGLinuxEventInput::postinit()
468 {
[...]
478 
479   udev_list_entry_foreach(dev_list_entry, devices) {
480     const char * path = udev_list_entry_get_name(dev_list_entry);
481     struct udev_device *dev = udev_device_new_from_syspath(udev, path);
482     const char * node = udev_device_get_devnode(dev);
483 
484     dev = udev_device_get_parent( dev );
485     const char * name = udev_device_get_sysattr_value(dev,"name");

udev_device_get_parent() returns NULL so the following call to udev_device_get_sysattr_value(dev,"name") crashes because of a null-pointer dereferencement.

That part of Flightgear code is quite old (2011) and should be stable here (anyway, udev_device_get_parent() can return NULL so the code should check that).

I don't know why there is no parent for the original dev (which is /dev/input/event0) and if this is expected or not.

Also, skipping line 484 with gdb allows Flightgear to start (but it may be skipping input devices).

I am still investigating...
Comment 2 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-05-17 09:59:58 UTC
Waiting for a proper fix, note that there are two possible workarounds :

- Remove event* device entries : rm -f /dev/input/event*
- Add -DEVENT_INPUT:BOOL=OFF to CMAKE_ARGS and rebuild the port

Both of those fixes will allow fgfs to start smoothly.

Best regards,
Ganael.
Comment 3 Val Packett 2019-05-19 16:39:36 UTC
Doesn't look like a parent is always guaranteed to exist in the actual Linux libudev:

https://github.com/systemd/systemd/blob/a166cd3aacdbfd4df196bb4ca9f43cff19cf9fec/src/libudev/libudev-device.c#L354

so that code should be patched to handle the case.

Our libudev only creates a parent in udev_device_new_from_devnum.
Comment 4 Aaron Farias 2019-05-20 21:07:11 UTC
Thank you very much it does work. With the quick fix of rm the files you told me 
You are very great for the great help. +1
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-05-22 21:48:13 UTC
A commit references this bug:

Author: martymac
Date: Wed May 22 21:47:46 UTC 2019
New revision: 502296
URL: https://svnweb.freebsd.org/changeset/ports/502296

Log:
  Disable EVENT_INPUT support on 13-CURRENT to avoid crashing during startup

  PR:		237835
  Submitted by:	Aaron Farias <timido@ubuntu.com>

Changes:
  head/games/flightgear/Makefile
Comment 6 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-05-22 21:56:34 UTC
Hi Aaron,

I've just committed a temporary fix for 13-CURRENT (waiting for a proper one).

Greg,

thank you very much for your feedback. Indeed, Flightgear code should be patched to handle the case where udev_device_get_parent() returns NULL. I'll see with Flightgear team what can be done here. I am a bit busy right now so don't expect news before one or two weeks.

Best regards,

Ganael.
Comment 7 Aaron Farias 2019-05-24 05:30:17 UTC
(gdb) run
Starting program: /usr/local/bin/fgfs 
[New LWP 100660 of process 6759]
[LWP 100660 of process 6759 exited]
[New LWP 100663 of process 6759]
[LWP 100663 of process 6759 exited]
[New LWP 100664 of process 6759]
FlightGear:  Version 2018.3.2
FlightGear:  Build Type Dev
Built with GNU C++ version 4.2
Jenkins number/ID 0:none
[LWP 100664 of process 6759 exited]
[New LWP 100665 of process 6759]
[LWP 100665 of process 6759 exited]
[New LWP 100668 of process 6759]
Comment 8 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-05-29 10:17:21 UTC
Hi,

FYI, I've opened a merge request on Flightgear side :

https://sourceforge.net/p/flightgear/flightgear/merge-requests/165/

Best regards,

Ganael.
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-05-29 15:46:05 UTC
A commit references this bug:

Author: martymac
Date: Wed May 29 15:45:06 UTC 2019
New revision: 502969
URL: https://svnweb.freebsd.org/changeset/ports/502969

Log:
  Re-enable EVENT_INPUT support on 13-CURRENT

  Patch has been accepted upstream, see:
  https://sourceforge.net/p/flightgear/flightgear/merge-requests/165/
  so we use it as a backport, waiting for next Flightgear version.

  PR:		237835
  Submitted by:	Aaron Farias <timido@ubuntu.com>

Changes:
  head/games/flightgear/Makefile
  head/games/flightgear/files/patch-src-Input-FGLinuxEventInput.cxx
Comment 10 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-05-29 15:46:50 UTC
Hi Aaron,

This has been fixed upstream. Thanks for your report!