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.18k forks source link

Game Crashing When Performing Time Consuming Actions in Vehicle #17335

Closed jordansinn1994 closed 8 years ago

jordansinn1994 commented 8 years ago

On linux x86_64 system with experimental builds with ncurses. This same save crashes on different builds and different systems. I'm in a vehicle, an RV, and upon moving debug shows messages about food and power generation. After a few turns a debug message takes over the window: Debug: Morale "Filthy Gear" is Inconsistent.

Function: player_morale::consistnent_with(const player_morale&) const::<labda(const player_morale&, const player_morale&)> FILE: src/morale.cpp LINE: 536

Press SPACEBAR to continue the game... Pres I (or i) to also ignore this particular message in the future.

After pressing i, I am able to move around. When attempting an action that requires some amount of time (such as reading, crafting, building, etc.) the game crashes and the terminal prints out some info as well as screen artifacts from the game. Some lines are: "/usr/include/c++/debug/safe_iterator.h: 182 error: attempt to copy

Objects involved in the operation: Iterator "this" @ 0x0x57eff18 { "

It ends with "aborted "core dumped" and my terminal behaves oddly after.

codemime commented 8 years ago

I can't reproduce this one, the saved game would be useful. It looks like something was trying to copy a unique pointer somewhere.

jordansinn1994 commented 8 years ago

save.zip

codemime commented 8 years ago

save.zip

Still, can't reproduce. Can anyone confirm that they have the crash too?

jordansinn1994 commented 8 years ago

I just downloaded the save file and loaded it with a freshly compiled experimental and experienced the crash on two different systems.

codemime commented 8 years ago

@jordansinn1994 Do you do anything else apart from the described?

jordansinn1994 commented 8 years ago

Start up the save and then do something that requires the sped up passage of time such as reading or crafting. It's failed every time for me guaranteed by going into the right hand room of the rv and using "R" to read the books that are in the storage 1 tile north of the bed.

codemime commented 8 years ago

Nope, I ran the freshly fetched master on a linux machine and it didn't crash. I'm not trying to say there's no possible crash, but I ask someone else to try and experience it. Maybe they'll be more lucky.

Which flags did you use for compiling? We had an issue that appeared only when SOUND=1.

jordansinn1994 commented 8 years ago

I used no flags for compiling and only compiled ncurses. I'll try a new build of it I suppose.

Zireael07 commented 8 years ago

There were a couple of issues that were OS-specific or bitness specific, too. Are you checking on Linux 64bits?

jordansinn1994 commented 8 years ago

I'm running Ubuntu 16.04 x86_64 as well as 14.04 x86_64

jordansinn1994 commented 8 years ago
 Stack trace of thread 28115:
                #0  0x00007f3dd007d418 __GI_raise (libc.so.6)
                #1  0x00007f3dd007f01a __GI_abort (libc.so.6)
                #2  0x00007f3dd09f5f85 _ZNK11__gnu_debug16_Error_formatter8_M_errorEv (libstdc++.so.6)
                #3  0x0000000000c0c3e4 _ZN11__gnu_debug14_Safe_iteratorINSt9__cxx199814_List_iteratorI4itemEENSt7__debug4listIS3_SaIS3_EEEEC4ERKS9_ (cataclysm)
                #4  0x00000000008d7395 _ZN3map24process_items_in_vehicleIPFbR10item_stackRN11__gnu_debug14_Safe_iteratorINSt9__cxx199814_List_iteratorI4itemEENSt7__debug4listIS7_SaIS7_EEEEERK8tripointNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvP7vehicleP6submapT_RKSN_ (cataclysm)
                #5  0x00000000008d8bf6 _ZN3map25process_items_in_vehiclesIPFbR10item_stackRN11__gnu_debug14_Safe_iteratorINSt9__cxx199814_List_iteratorI4itemEENSt7__debug4listIS7_SaIS7_EEEEERK8tripointNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvP6submapT_RKSN_ (cataclysm)
                #6  0x00000000008d8ea8 _ZN3map13process_itemsIPFbR10item_stackRN11__gnu_debug14_Safe_iteratorINSt9__cxx199814_List_iteratorI4itemEENSt7__debug4listIS7_SaIS7_EEEEERK8tripointNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvbT_RKSN_ (cataclysm)
                #7  0x00000000008b7af2 _ZN3map20process_active_itemsEv (cataclysm)
                #8  0x00000000009feb67 _ZN4game7do_turnEv (cataclysm)
                #9  0x0000000000a3b994 main (cataclysm)
                #10 0x00007f3dd0068830 __libc_start_main (libc.so.6)
                #11 0x0000000000408489 _start (cataclysm)
jordansinn1994 commented 8 years ago
#0  0x00007f3dd007d418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007f3dd007f01a in __GI_abort () at abort.c:89
#2  0x00007f3dd09f5f85 in __gnu_debug::_Error_formatter::_M_error() const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x0000000000c0c3e4 in __gnu_debug::_Safe_iterator<std::__cxx1998::_List_iterator<item>, std::__debug::list<item, std::allocator<item> > >::_Safe_iterator (__x=..., this=0x6920668) at /usr/include/c++/5/debug/safe_iterator.h:178
#4  item_reference::item_reference (this=0x6920650) at src/active_item_cache.h:11
#5  std::__cxx1998::_List_node<item_reference>::_List_node<item_reference const&> (this=0x6920640)
    at /usr/include/c++/5/bits/stl_list.h:114
#6  __gnu_cxx::new_allocator<std::__cxx1998::_List_node<item_reference> >::construct<std::__cxx1998::_List_node<item_reference>, item_reference const&> (__p=0x6920640, this=<optimized out>) at /usr/include/c++/5/ext/new_allocator.h:120
#7  std::__cxx1998::__cxx11::list<item_reference, std::allocator<item_reference> >::_M_create_node<item_reference const&> (
    this=0x7ffc544536a8) at /usr/include/c++/5/bits/stl_list.h:574
#8  std::__cxx1998::__cxx11::list<item_reference, std::allocator<item_reference> >::_M_insert<item_reference const&> (
    __position=..., this=0x7ffc544536a8) at /usr/include/c++/5/bits/stl_list.h:1763
#9  std::__cxx1998::__cxx11::list<item_reference, std::allocator<item_reference> >::push_back (__x=..., this=0x7ffc544536a8)
    at /usr/include/c++/5/bits/stl_list.h:1089
#10 active_item_cache::get (this=<optimized out>) at src/active_item_cache.cpp:43
#11 0x00000000008d7395 in map::process_items_in_vehicle<bool (*)(item_stack&, __gnu_debug::_Safe_iterator<std::__cxx1998::_List_iterator<item>, std::__debug::list<item, std::allocator<item> > >&, tripoint const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)> (this=this@entry=0x2ad83c0, cur_veh=0x6908430, current_submap=current_submap@entry=0x68c1340, 
    processor=processor@entry=0x8a33fb <process_map_items(item_stack&, std::__debug::list<item, std::allocator<item> >::iterator&, tripoint const&, std::__cxx11::string)>, signal="") at src/map.cpp:4910
#12 0x00000000008d8bf6 in map::process_items_in_vehicles<bool (*)(item_stack&, __gnu_debug::_Safe_iterator<std::__cxx1998::_List_iterator<item>, std::__debug::list<item, std::allocator<item> > >&, tripoint const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)> (this=this@entry=0x2ad83c0, current_submap=current_submap@entry=0x68c1340, 
    processor=processor@entry=0x8a33fb <process_map_items(item_stack&, std::__debug::list<item, std::allocator<item> >::iterator&, tripoint const&, std::__cxx11::string)>, signal="") at src/map.cpp:4897
#13 0x00000000008d8ea8 in map::process_items<bool (*)(item_stack&, __gnu_debug::_Safe_iterator<std::__cxx1998::_List_iterator<item>, std::__debug::list<item, std::allocator<item> > >&, tripoint const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)> (this=0x2ad83c0, active=active@entry=true, 
    processor=processor@entry=0x8a33fb <process_map_items(item_stack&, std::__debug::list<item, std::allocator<item> >::iterator&, tripoint const&, std::__cxx11::string)>, signal="") at src/map.cpp:4849
#14 0x00000000008b7af2 in map::process_active_items (this=<optimized out>) at src/map.cpp:4831
#15 0x00000000009feb67 in game::do_turn (this=0x2ad7f80) at src/game.cpp:1472
#16 0x0000000000a3b994 in main (argc=<optimized out>, argv=0x7ffc54454cc0) at src/main.cpp:468
codemime commented 8 years ago

As far as I can say (looking at your stack traces) the issue has nothing to do with the debug message Morale "Filthy Gear" is Inconsistent so the title is misleading and should be changed. The real reason of the crash is probably an invalidated vehicle iterator. And the most probable reason of invalidation is an item being removed during iterating over its container.

jordansinn1994 commented 8 years ago

Seems to be related to performing tasks such as reading, crafting, or sleeping in the RV. I'm able to go outside and perform these tasks without the crash. When walking into the RV's hanging mirror I receive the debug message but the crash does not happen. Seems to happen for any vehicle. There is a truck south that has the same behavior.

drbig commented 8 years ago

Replicated: Yup

Yeah, stack traces point to the root of the problem...