Bug 2331176 - fgfs (simgear) segfaults with std::__glibcxx_assert_fail
Summary: fgfs (simgear) segfaults with std::__glibcxx_assert_fail
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: FlightGear-data
Version: 41
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Fabrice Bellet
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-12-09 16:33 UTC by François Cami
Modified: 2025-01-04 04:42 UTC (History)
2 users (show)

Fixed In Version: FlightGear-data-2020.3.19-7.fc42 FlightGear-data-2020.3.19-7.fc40 FlightGear-data-2020.3.19-7.fc41
Clone Of:
Environment:
Last Closed: 2024-12-26 13:55:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description François Cami 2024-12-09 16:33:03 UTC
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44                                                                
44	      return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
[Current thread is 1 (Thread 0x7fbe98ff96c0 (LWP 290551))]
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fbf04a7ed03 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007fbf04a25d1e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fbf04a0d942 in __GI_abort () at abort.c:79
#4  0x00007fbf04c3ebb0 in std::__glibcxx_assert_fail (file=file@entry=0x7fbf07e74b08 "/usr/include/c++/14/bits/stl_vector.h", line=line@entry=1213, 
    function=function@entry=0x7fbf07e79690 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::front() [with _Tp = unsigned int; _Alloc = std::allocator<unsigned int>; reference = unsigned int&]", condition=condition@entry=0x7fbf07e6f0ff "!this->empty()") at ../../../../../libstdc++-v3/src/c++11/assert_fail.cc:41
#5  0x00007fbf07d7234e in std::vector<unsigned int, std::allocator<unsigned int> >::front (this=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1211
#6  std::vector<unsigned int, std::allocator<unsigned int> >::front (this=0x7fbe98ff4810) at /usr/include/c++/14/bits/stl_vector.h:1211
#7  simgear::effect::computeMipmap (image=0x7fbe0f628740, attrs=std::tuple containing = {...}) at /usr/src/debug/SimGear-2020.3.19-4.fc41.x86_64/simgear/scene/material/mipmap.cxx:306
#8  0x00007fbf07d82c7d in simgear::ModelRegistry::readImage (this=<optimized out>, fileName=..., opt=<optimized out>)
    at /usr/src/debug/SimGear-2020.3.19-4.fc41.x86_64/simgear/scene/model/ModelRegistry.cxx:595
#9  0x00007fbf07fc4607 in osgDB::Registry::readImage (this=<optimized out>, fileName="/usr/share/flightgear/Aircraft/Generic/Effects/null_bumpspec.png", options=0x7fbe400008e0)
    at /usr/src/debug/OpenSceneGraph-3.6.5-29.fc41.x86_64/include/osgDB/Registry:221
#10 osgDB::readRefImageFile (filename="/usr/share/flightgear/Aircraft/Generic/Effects/null_bumpspec.png", options=options@entry=0x7fbe400008e0)
    at /usr/src/debug/OpenSceneGraph-3.6.5-29.fc41.x86_64/src/osgDB/ReadFile.cpp:106
#11 0x00007fbf07d59a67 in simgear::(anonymous namespace)::setAttrs (attrs=std::tuple containing = {...}, tex=0x7fbe0f4b9130, options=0x7fbe400008e0)
    at /usr/src/debug/SimGear-2020.3.19-4.fc41.x86_64/simgear/scene/material/TextureBuilder.cxx:282
#12 0x00007fbf07d619db in simgear::TexBuilder<osg::Texture2D>::build (this=0x56046f17ed70, effect=<optimized out>, pass=<optimized out>, props=<optimized out>, options=0x7fbe400008e0)
    at /usr/src/debug/SimGear-2020.3.19-4.fc41.x86_64/simgear/scene/material/TextureBuilder.cxx:354
#13 0x00007fbf07d59758 in simgear::TextureUnitBuilder::buildAttribute (this=<optimized out>, effect=0x7fbe0f5b5f60, pass=0x7fbe0f625950, prop=0x7fbe0f5e06d0, options=0x7fbe400008e0)
    at /usr/src/debug/SimGear-2020.3.19-4.fc41.x86_64/simgear/scene/material/TextureBuilder.cxx:139

This is because the bumpspec png is 1x1 and the code expects 2x2 as a minimum, but does not raise any error.
Enlarging the texture to 2x2 (or any power of 2) fixes the crash.

This can be done in two ways:

1/ With ImageMagic as a build dep:
$ magick null_bumpspec.png -resize 2 null_bumpspec.png

2/ by including upstream's new null_bumpspec.png in the lookaside cache, as the new file is 32x32:
https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Aircraft/Generic/Effects/null_bumpspec.png?format=raw

I am partial to doing 1 as it solves the crash without adding binary data that won't be reused. 

I can co-maint if you like. 

Reproducible: Always

Steps to Reproduce:
1. Launch fgfs twice, watch it crash the second time

Note that using --ignore-autosave makes the problem go away.

Comment 1 François Cami 2024-12-23 19:40:24 UTC
I can fix this if you set me as co-maint (FAS:fcami).

Comment 2 Fabrice Bellet 2024-12-26 13:21:45 UTC
Sorry for the delay, I hoped 2024.1 would came out faster with the fix. Anyway, I included your 1/ suggestion. Thanks!

Comment 3 Fedora Update System 2024-12-26 13:51:31 UTC
FEDORA-2024-d25fb32cc6 (FlightGear-data-2020.3.19-7.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-d25fb32cc6

Comment 4 Fedora Update System 2024-12-26 13:55:14 UTC
FEDORA-2024-b5a32bf547 (FlightGear-data-2020.3.19-7.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-b5a32bf547

Comment 5 Fedora Update System 2024-12-26 13:55:50 UTC
FEDORA-2024-d25fb32cc6 (FlightGear-data-2020.3.19-7.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2024-12-27 02:28:10 UTC
FEDORA-2024-cbfce159e8 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-cbfce159e8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-cbfce159e8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2024-12-27 04:31:24 UTC
FEDORA-2024-b5a32bf547 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-b5a32bf547`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-b5a32bf547

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2025-01-04 02:44:25 UTC
FEDORA-2024-b5a32bf547 (FlightGear-data-2020.3.19-7.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2025-01-04 04:42:57 UTC
FEDORA-2024-cbfce159e8 (FlightGear-data-2020.3.19-7.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.