CleverRaven / Cataclysm-DDA

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

Crash on quit without saving #54886

Open NetSysFire opened 2 years ago

NetSysFire commented 2 years ago

Describe the bug

Sometimes, usually in debug worlds only, I just alt+f4 the window because no turn has passed because I just navigated around some menus to test stuff. This works well, nothing breaks, except when the game has been idling some time.

Basically a proper issue for https://github.com/CleverRaven/Cataclysm-DDA/issues/53551#issuecomment-1005776682

Steps to reproduce

  1. Load a save.
  2. Do nothing, leave the game idle a couple of hours. 2.1 This only works sometimes. If you trigger any debugmsg, usually requires turns to pass and therefore "savescumming", the probablity of this happening increases.
  3. alt+f4 the window (Sends SIGTERM to cataclysm-tiles, this is a graceful quit which is handled properly).
  4. Crash
This option is not available. Please see --help for all possible usages.
The program has crashed.
See the log file for a stack trace.
CRASH LOG FILE: @U@Ueal/.config/cataclysm-dda/crash.log
VERSION: 0.F
TYPE: Signal
MESSAGE: SIGSEGV: Segmentation faultError creating SDL message box: zenity reported error or failed to launch: 255

STACK TRACE:

    cataclysm-tiles(debug_write_backtrace(std::ostream&)+0x46) [0x55ddbd26c6b6]
    cataclysm-tiles(+0xa0edfc) [0x55ddbd249dfc]
    cataclysm-tiles(+0xa0f085) [0x55ddbd24a085]
    /usr/lib/libc.so.6(+0x3cda0) [0x7fb5f1cb0da0]
    cataclysm-tiles(ui_adaptor::invalidate(rectangle<point, 0> const&, bool)+0x3b) [0x55ddbdc84863]
    cataclysm-tiles(ui_adaptor::~ui_adaptor()+0x62) [0x55ddbdc84b02]
    cataclysm-tiles(std::unique_ptr<ui_adaptor, std::default_delete<ui_adaptor> >::~unique_ptr()+0x16) [0x55ddbd01c038]
    cataclysm-tiles(live_view::~live_view()+0x11) [0x55ddbd6664fd]
    cataclysm-tiles(std::unique_ptr<live_view, std::default_delete<live_view> >::~unique_ptr()+0x16) [0x55ddbd3edaf4]
    cataclysm-tiles(game::~game()+0x16d) [0x55ddbd3ab0ff]
    cataclysm-tiles(std::unique_ptr<game, std::default_delete<game> >::~unique_ptr()+0x15) [0x55ddbd3f2095]
    /usr/lib/libc.so.6(+0x3f4a7) [0x7fb5f1cb34a7]
    /usr/lib/libc.so.6(+0x3f64e) [0x7fb5f1cb364e]
    cataclysm-tiles(+0x1392792) [0x55ddbdbcd792]
    cataclysm-tiles(input_manager::get_input_event(keyboard_mode)+0xcb) [0x55ddbdbcd977]
    cataclysm-tiles(input_context::handle_input[abi:cxx11](int)+0x6e) [0x55ddbd4a5fea]
    cataclysm-tiles(game::handle_mouseview(input_context&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)+0x48) [0x55ddbd3a64cc]
    cataclysm-tiles(game::get_player_input(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)+0xb03) [0x55ddbd4336a9]
    cataclysm-tiles(game::handle_action()+0x166) [0x55ddbd440c3a]
    cataclysm-tiles(do_turn()+0x5bb) [0x55ddbd2d869d]

    Attempting to repeat stack trace using debug symbols…
    debug_write_backtrace(std::ostream&)
    ??:?
    init_crash_handlers()
    ??:?
    init_crash_handlers()
    ??:?
    ??
    ??:0
    ui_adaptor::invalidate(rectangle<point, 0> const&, bool)
    ??:?
    ui_adaptor::~ui_adaptor()
    ??:?
    std::unique_ptr<ui_adaptor, std::default_delete<ui_adaptor> >::~unique_ptr()
    ??:?
    live_view::~live_view()
    ??:?
    std::unique_ptr<live_view, std::default_delete<live_view> >::~unique_ptr()
    ??:?
    game::~game()
    ??:?
    std::unique_ptr<game, std::default_delete<game> >::~unique_ptr()
    ??:?
    ??
    ??:0
    ??
    ??:0
    save_screenshot(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    ??:?
    input_manager::get_input_event(keyboard_mode)
    ??:?
    input_context::handle_input[abi:cxx11](int)
    ??:?
    game::handle_mouseview(input_context&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)
    ??:?
    game::get_player_input(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)
    ??:?
    game::handle_action()
    ??:?
    do_turn()
    ??:?

The "This option is not available line" (this is from the stdout) is something related to lines I get on other crashes:

/usr/include/c++/11.1.0/bits/regex_executor.tcc:537: void std::__detail::_Executor< <template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>, <anonymous> >::_M_dfs(std::__detail::_Executor< <template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>, <anonymous> >::_Match_mode, std::__detail::_StateIdT) [with _BiIter = const char*; _Alloc = std::allocator<std::__cxx11::sub_match<const char*> >; _TraitsT = std::__cxx11::regex_traits<char>;bool __dfs_mode = true; std::__detail::_StateIdT = long int]: Assertion 'false' failed.
This option is not available. Please see --help for all possible usages.
/usr/include/c++/11.1.0/bits/regex_executor.tcc:537: void std::__detail::_Executor< <template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>, <anonymous> >::_M_dfs(std::__detail::_Executor< <template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>, <anonymous> >::_Match_mode, std::__detail::_StateIdT) [with _BiIter = const char*; _Alloc = std::allocator<std::__cxx11::sub_match<const char*> >; _TraitsT = std::__cxx11::regex_traits<char>;bool __dfs_mode = true; std::__detail::_StateIdT = long int]: Assertion 'false' failed.

Expected behavior

Here is the freaky thing: It only happens sometimes and, for whatever reasons, the crash log file name is corrupted and leaves garbage file names containing the same crash log I got on my stdout (see above) in the current working directory.

-rw-r--r--  1 username username    3110 Jan 15 22:49 ''$'\320''('$'\227'')'$'\310''U'
-rw-r--r--  1 username username    3110 Jan 26 05:27 '@'$'\217\374\353\312''U'
-rw-r--r--  1 username username    3110 Jan 28 16:08 '@'$'\257\222\276\335''U'
-rw-r--r--  1 username username    3110 Jan 25 20:05 '@'$'\337\363\224''`U'
-rw-r--r--  1 username username    3110 Jan 27 06:55 '@'$'\257'';('$'\202''U'
-rw-r--r--  1 username username    3110 Jan 13 19:14 ''$'\320\370\005''?'$'\v''V'
-rw-r--r--  1 username username    3110 Jan 22 15:31 '@'$'\037\270''`'$'\005''V'

This did not happen in 0.F-stable but persisted through every experimental I tried so far.

Contrary to what the stack trace said, I did exactly nothing. I did not attempt to save any screenshot.

Screenshots

No response

Versions and configuration

This is on Xorg/X11

Additional context

No response

NetSysFire commented 2 years ago

I FINALLY GOT A TRACE: gdb.txt

Sorry for caps but I am excited I can finally provide a new lead because this crash is just so damn inconsistent and annoying.

NetSysFire commented 2 years ago

Looking at the trace, it looks like the culprit might be somewhere around:

padding = "\000\177\000\000Q\315\004", '\000' <repeats 48 times>}

This looks almost exactly like the corruption I got in the crash log filenames.