calref / cboe

Classic Blades of Exile
http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/
Other
169 stars 41 forks source link

Occasional segfault displaying startup spiderweb logo. #226

Closed clort81 closed 4 years ago

clort81 commented 4 years ago

Removing show_logo(); from boe.main.cpp avoids the crash.

backtrace

Starting program: /big/pcbak/Projects/games/openboe/cboe-dark2/build/Blades of Exile/Blades of Exile 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
"/big/pcbak/Projects/games/openboe/cboe-dark2/build/Blades of Exile"
AL lib: (EE) alcOpenDevice: Unsupported channels: 2
[New Thread 0x7fb50dd090 (LWP 20744)]
[New Thread 0x7fb46b5090 (LWP 20745)]
[New Thread 0x7faffff090 (LWP 20746)]
[xcb] Unknown sequence number while processing reply
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
Blades of Exile: ../../src/xcb_io.c:641: _XReply: Assertion `!xcb_xlib_threads_sequence_lost' failed.

Thread 4 "Blades of Exile" received signal SIGABRT, Aborted.
[Switching to Thread 0x7faffff090 (LWP 20746)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000007fb779ae68 in __GI_abort () at abort.c:79
#2  0x0000007fb77a628c in __assert_fail_base (fmt=0x7fb789bb88 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7fb7c6d440 "!xcb_xlib_threads_sequence_lost", 
    file=file@entry=0x7fb7c6d300 "../../src/xcb_io.c", line=line@entry=641, 
    function=function@entry=0x7fb7c6d7b0 "_XReply") at assert.c:92
#3  0x0000007fb77a62f4 in __GI___assert_fail (assertion=0x7fb7c6d440 "!xcb_xlib_threads_sequence_lost", 
    file=0x7fb7c6d300 "../../src/xcb_io.c", line=641, function=0x7fb7c6d7b0 "_XReply") at assert.c:101
#4  0x0000007fb7c00bd8 in _XReply () from /usr/lib/aarch64-linux-gnu/libX11.so.6
#5  0x0000007fb6eae60c in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0
#6  0x0000007fb6eb0944 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0
#7  0x0000007fb73cdc5c in ?? () from /usr/lib/aarch64-linux-gnu/libGLX.so.0
#8  0x0000007fb73cf6a0 in ?? () from /usr/lib/aarch64-linux-gnu/libGLX.so.0
#9  0x0000007fb7eb1228 in ?? () from /usr/lib/aarch64-linux-gnu/libsfml-window.so.2.5
#10 0x0000007fb7ea3a20 in ?? () from /usr/lib/aarch64-linux-gnu/libsfml-window.so.2.5
#11 0x0000007fb7ea3d0c in ?? () from /usr/lib/aarch64-linux-gnu/libsfml-window.so.2.5
#12 0x0000007fb7e3fed4 in sf::Texture::create(unsigned int, unsigned int) ()
   from /usr/lib/aarch64-linux-gnu/libsfml-graphics.so.2.5
#13 0x0000007fb7e40528 in sf::Texture::loadFromImage(sf::Image const&, sf::Rect<int> const&) ()
--Type <RET> for more, q to quit, c to continue without paging--c
  64-linux-gnu/libsfml-graphics.so.2.5
#14 0x0000007fb7e40794 in sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&) () from /usr/lib/aarch64-linux-gnu/libsfml-graphics.so.2.5
#15 0x0000005555605938 in ResMgr::resLoader<sf::Texture>::operator() (this=0x7fafffe580, fpath=...) at src/fileio/resmgr/res_image.hpp:25
#16 0x0000005555605ef8 in ResMgr::get<sf::Texture> (name="startanim") at src/fileio/resmgr/resmgr.hpp:160
#17 0x00000055555fb3dc in init_startup () at build/obj/game/boe.graphics.cpp:204
#18 0x000000555562e688 in <lambda()>::operator()(void) const (__closure=0x5555eae452) at build/obj/game/boe.main.cpp:180
#19 0x0000005555632300 in boost::detail::thread_data<init_boe(int, char**)::<lambda()> >::run(void) (this=0x5555eae310) at /usr/include/boost/thread/detail/thread.hpp:117
#20 0x0000007fb7eff534 in ?? () from /usr/lib/aarch64-linux-gnu/libboost_thread.so.1.67.0
#21 0x0000007fb7b96888 in start_thread (arg=0x7fffffe6df) at pthread_create.c:486
#22 0x0000007fb784778c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
clort81 commented 4 years ago

Thanks to xq! Commenting out three lines in game/boe.main.cpp fixed the crash for me.

//Clort boost::thread init_thread([]() {
                init_buf();
                check_for_intel();
                srand(time(nullptr));
                init_screen_locs();
                init_startup();
                flushingInput = true;
//Clort });
        show_logo();
        if(get_bool_pref("ShowStartupSplash", true))
                plop_fancy_startup();
//Clort init_thread.join();

lines 174-185 Tested game startup 40 times with varying loads to X11 (instances of glxgears and other programs). Also 10 times launched from gdb. No more segfaults during Spiderweb logo! No more tears.

CelticMinstrel commented 4 years ago

Fixed in 44f18420bd7bfec3b2649248f2c1125dcf11caa5

CelticMinstrel commented 4 years ago

Never tested whether the scenario editor (which also had an init thread) exhibited this bug, but if so, it was fixed in a5a7f161c887cb28c4169c9aa4655b2c6326a346.