CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.63k stars 4.17k forks source link

imgui related crash when quitting during a blocking activity (falling asleep) #73667

Closed NetSysFire closed 2 months ago

NetSysFire commented 6 months ago

Describe the bug

Luckily not too bad of a crash.

Attach save file

n/a

Steps to reproduce

  1. Try to e.g fall asleep (spawn 50 chamomile tea, drink it until you are exhausted) or have a similar handle_key_blocking_activity. Waiting will probably work here, too.
  2. Alt F4 the game. aka send a SIGTERM to it.
  3. Crash.
    0x55c,f3f,0c3,c1f    src/debug.cpp:966    bt_full
    0x55c,f3f,0c3,c1f    src/debug.cpp:1,231    debug_write_backtrace(std::ostream&)
    0x55c,f3f,09b,d5a    src/crash.cpp:89    log_crash
    0x55c,f3f,09c,0a7    src/crash.cpp:146    signal_handler
    0x7fb,5a4,748,e1f    [unknown src]:0    [unknown func]
    0x55c,f3f,bf6,ec5    src/ui_manager.cpp:322    ui_adaptor::invalidate(rectangle<point, 0> const&, bool)
    0x55c,f3f,bf6,ec5    src/ui_manager.cpp:309    ui_adaptor::invalidate(rectangle<point, 0> const&, bool)
    0x55c,f3f,bf7,11e    src/ui_manager.cpp:501    ui_manager::invalidate(rectangle<point, 0> const&, bool)
    0x55c,f3f,bf7,11e    src/ui_manager.cpp:93    ui_adaptor::~ui_adaptor()
    0x55c,f3e,e3d,725    /usr/include/c++/9/bits/unique_ptr.h:81    std::default_delete<ui_adaptor>::operator()(ui_adaptor*) const
    0x55c,f3e,f1e,e71    src/cata_imgui.cpp:457    cataimgui::window_impl::~window_impl()
    0x55c,f3e,f1e,e71    /usr/include/c++/9/bits/unique_ptr.h:81    std::default_delete<cataimgui::window_impl>::operator()(cataimgui::window_impl*) const
    0x55c,f3e,f1e,e71    /usr/include/c++/9/bits/unique_ptr.h:75    std::default_delete<cataimgui::window_impl>::operator()(cataimgui::window_impl*) const
    0x55c,f3e,f1e,f00    /usr/include/c++/9/bits/unique_ptr.h:402    std::unique_ptr<cataimgui::window_impl, std::default_delete<cataimgui::window_impl> >::reset(cataimgui::window_impl*)
    0x55c,f3e,f1e,f00    src/cata_imgui.cpp:504    cataimgui::window::~window()
    0x55c,f3e,e6e,70f    /usr/include/c++/9/bits/shared_ptr_base.h:155    std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
    0x55c,f3e,e6e,70f    /usr/include/c++/9/bits/shared_ptr_base.h:148    std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
    0x55c,f3e,e6e,70f    /usr/include/c++/9/bits/shared_ptr_base.h:730    std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()
    0x55c,f3e,e6e,70f    /usr/include/c++/9/bits/shared_ptr_base.h:1,169    std::__shared_ptr<query_popup_impl, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr()
    0x55c,f3e,e6e,70f    /usr/include/c++/9/bits/shared_ptr.h:103    std::shared_ptr<query_popup_impl>::~shared_ptr()
    0x55c,f3e,e6e,70f    src/popup.h:271    static_popup::~static_popup()
    0x55c,f3f,24a,52a    /usr/include/c++/9/bits/unique_ptr.h:81    std::default_delete<static_popup>::operator()(static_popup*) const
    0x55c,f3f,24a,52a    /usr/include/c++/9/bits/unique_ptr.h:292    std::unique_ptr<static_popup, std::default_delete<static_popup> >::~unique_ptr()
    0x55c,f3f,22c,ef7    src/game.h:142    game::~game()
    0x55c,f3f,257,14e    /usr/include/c++/9/bits/unique_ptr.h:81    std::default_delete<game>::operator()(game*) const
    0x55c,f3f,257,14e    /usr/include/c++/9/bits/unique_ptr.h:292    std::unique_ptr<game, std::default_delete<game> >::~unique_ptr()
    0x7fb,5a4,74b,2e5    [unknown src]:0    [unknown func]
    0x7fb,5a4,74b,42d    [unknown src]:0    [unknown func]
    0x55c,f3f,a90,233    src/sdltiles.cpp:3,479    CheckMessages
    0x55c,f3f,a90,440    src/sdltiles.cpp:3,828    input_manager::get_input_event(keyboard_mode)
    0x55c,f3f,2fe,0cd    src/input_context.cpp:442    input_context::handle_input[abi:cxx11](int)
    0x55c,f3f,126,dee    src/do_turn.cpp:236    handle_key_blocking_activity()
    0x55c,f3f,128,2df    src/do_turn.cpp:604    do_turn()
    0x55c,f3e,c23,ea8    src/main.cpp:868    main
    0x7fb,5a4,731,d49    [unknown src]:0    [unknown func]
    0x7fb,5a4,731,e0b    [unknown src]:0    [unknown func]
    0x55c,f3e,d8b,a2d    [unknown src]:0    [unknown func]
    0xf,fff,fff,fff,fff,fff    [unknown src]:0    [unknown func]

Expected behavior

No crash. I know that in some cases when you ctrl+c the game, which sends SIGINT instead of SIGTERM, there is a "really quit? want to save?" dialogue.

Screenshots

No response

Versions and configuration

Additional context

I can reliably reproduce the corrupted crash log thing with this!! #54886

NetSysFire commented 2 months ago

New trace:

``` Debuginfod has been disabled. To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit. [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0x7fffecfff6c0 (LWP 2167405)] [New Thread 0x7fffdf9ff6c0 (LWP 2167406)] [New Thread 0x7fffdf1fe6c0 (LWP 2167407)] [New Thread 0x7fffde9fd6c0 (LWP 2167408)] [New Thread 0x7fffde1fc6c0 (LWP 2167409)] [New Thread 0x7fffdd5fb6c0 (LWP 2167410)] [New Thread 0x7fffdcdfa6c0 (LWP 2167411)] [New Thread 0x7fffc7fff6c0 (LWP 2167412)] [New Thread 0x7fffc77fe6c0 (LWP 2167413)] [New Thread 0x7fffc6ffd6c0 (LWP 2167414)] [Thread 0x7fffc6ffd6c0 (LWP 2167414) exited] [Thread 0x7fffc77fe6c0 (LWP 2167413) exited] [Thread 0x7fffc7fff6c0 (LWP 2167412) exited] [New Thread 0x7fffc7fff6c0 (LWP 2167415)] [New Thread 0x7fffc77fe6c0 (LWP 2167416)] [New Thread 0x7fffc6ffd6c0 (LWP 2167417)] [New Thread 0x7fffc5dff6c0 (LWP 2167420)] [New Thread 0x7fffdc0e26c0 (LWP 2167421)] [New Thread 0x7fffc55fe6c0 (LWP 2167422)] [Thread 0x7fffc55fe6c0 (LWP 2167422) exited] [Thread 0x7fffc6ffd6c0 (LWP 2167417) exited] [Thread 0x7fffc77fe6c0 (LWP 2167416) exited] [Thread 0x7fffc7fff6c0 (LWP 2167415) exited] [Thread 0x7fffdcdfa6c0 (LWP 2167411) exited] [Thread 0x7fffdd5fb6c0 (LWP 2167410) exited] [Thread 0x7fffde1fc6c0 (LWP 2167409) exited] [Thread 0x7fffde9fd6c0 (LWP 2167408) exited] [Thread 0x7fffdf1fe6c0 (LWP 2167407) exited] [Thread 0x7fffdf9ff6c0 (LWP 2167406) exited] [Thread 0x7fffdc0e26c0 (LWP 2167421) exited] [Thread 0x7fffc5dff6c0 (LWP 2167420) exited] [Thread 0x7fffecfff6c0 (LWP 2167405) exited] Thread 1 "cataclysm-tiles" received signal SIGSEGV, Segmentation fault. ui_adaptor::invalidate () at src/ui_manager.cpp:322 warning: 322 src/ui_manager.cpp: No such file or directory Thread 1 (Thread 0x7ffff6a167c0 (LWP 2167293) "cataclysm-tiles"): #0 ui_adaptor::invalidate () at src/ui_manager.cpp:322 No locals. #1 ui_adaptor::invalidate () at src/ui_manager.cpp:309 No locals. #2 0x0000555556d04d91 in ui_manager::invalidate () at src/ui_manager.cpp:501 No locals. #3 ui_adaptor::~ui_adaptor () at src/ui_manager.cpp:93 No locals. #4 0x0000555555f1a2c0 in std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:81 No locals. #5 0x0000555556000702 in cataimgui::window_impl::~window_impl () at src/cata_imgui.cpp:490 No locals. #6 std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:81 No locals. #7 std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:75 No locals. #8 0x0000555556000791 in std::unique_ptr >::reset () at /usr/include/c++/9/bits/unique_ptr.h:402 No locals. #9 cataimgui::window::~window () at src/cata_imgui.cpp:537 No locals. #10 0x0000555555f4d114 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release () at /usr/include/c++/9/bits/shared_ptr_base.h:155 No locals. #11 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release () at /usr/include/c++/9/bits/shared_ptr_base.h:148 No locals. #12 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count () at /usr/include/c++/9/bits/shared_ptr_base.h:730 No locals. #13 std::__shared_ptr::~__shared_ptr () at /usr/include/c++/9/bits/shared_ptr_base.h:1169 No locals. #14 std::shared_ptr::~shared_ptr () at /usr/include/c++/9/bits/shared_ptr.h:103 No locals. #15 static_popup::~static_popup () at src/popup.h:271 No locals. #16 0x000055555633c90d in std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:81 No locals. #17 std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:75 No locals. #18 std::unique_ptr >::~unique_ptr () at /usr/include/c++/9/bits/unique_ptr.h:292 No locals. #19 0x000055555631fe68 in game::~game () at src/game.h:142 No locals. #20 0x0000555556349165 in std::default_delete::operator() () at /usr/include/c++/9/bits/unique_ptr.h:81 No locals. #21 std::unique_ptr >::~unique_ptr () at /usr/include/c++/9/bits/unique_ptr.h:292 No locals. #22 0x00007ffff775f891 in ?? () from /usr/lib/libc.so.6 No symbol table info available. #23 0x00007ffff775f95e in exit () from /usr/lib/libc.so.6 No symbol table info available. #24 0x0000555556b9c543 in CheckMessages () at src/sdltiles.cpp:3508 No locals. #25 0x0000555556b9c5fa in input_manager::pump_events () at src/sdltiles.cpp:3790 No locals. #26 0x0000555556a7ea59 in eff_fun_sleep () at src/player_hardcoded_effects.cpp:1034 No locals. #27 0x0000555556a87006 in std::function::operator() () at /usr/include/c++/9/bits/std_function.h:688 No locals. #28 Character::hardcoded_effects () at src/player_hardcoded_effects.cpp:1264 No locals. #29 0x0000555556053f09 in Character::process_one_effect () at src/character.cpp:10815 No locals. #30 0x000055555606f585 in Character::process_effects () at src/character.cpp:11121 No locals. #31 0x0000555556186425 in Creature::process_turn () at src/creature.cpp:358 No locals. #32 Creature::process_turn () at src/creature.cpp:350 No locals. #33 0x000055555606db5f in Character::process_turn () at src/character.cpp:2348 No locals. #34 0x000055555620f47a in do_turn () at src/do_turn.cpp:676 No locals. #35 0x0000555555cf8a2d in main () at src/main.cpp:873 No locals. ```
NetSysFire commented 2 months ago

So I found out that it is mandatory to use --userdir ~/.local/share/cataclysm-dda/ --configdir ~/.config/cataclysm-dda/ to reproduce this corrupted path. I think its because of the length of the path.

The crash still happens without the args but when these args are used, it will reliably corrupt the path.

The user below had this crash path with a 4 char username, erus: �(���dus/.config/cataclysm-dda/crash.log For reference, mine is 13 chars long, user12345name and the binary garbage that gets prepended to my path is longer.

erus commented 2 months ago

So I found out that it is mandatory to use --userdir ~/.local/share/cataclysm-dda/ --configdir ~/.config/cataclysm-dda/ to reproduce this. I think its because of the length of the path.

I was able to reproduce this just now, specifically by sending SIGTERM and using the above command line arguments.