CleverRaven / Cataclysm-DDA

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

Segmentation fault upon unloading canning pot, crash upon loading savefile #66342

Open Euvinl opened 1 year ago

Euvinl commented 1 year ago

Describe the bug

The game crashed while unloading a canning pot due to a segmentation fault. Upon reloading the save, immediately on startup, after all files are loaded, the game crashes immediately due to a segmentation fault. There is no way to enter the debug menu.

Attach save file

Montreal - bugged.zip

Steps to reproduce

[?]Load canning pot with items (Auto-insert from looting stuff?), unload it. Load save.

Expected behavior

Game not crashing upon unloading a pot

Screenshots

No response

Versions and configuration

-Windows 10 -0.G -Tiles -English "dda", "no_npc_food", "personal_portal_storms", "no_fungal_growth", "package_bionic_professions", "No_Rail_Stations", "MMA", "alt_map_key", "blazeindustries", "stats_through_kills", "StatsThroughSkills", "speedydex", "magiclysm", "xedra_evolved", "Tamable_Wildlife"

Additional context

crash.log debug.log Montreal - bugged.zip

kevingranade commented 1 year ago

This issue has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/segmentation-fault-crash-on-loading/28843/5

RenechCDDA commented 1 year ago

It crashes on load, but on experimental it produces a different log.

VERSION: 8846e84 TYPE: Signal MESSAGE: SIGSEGV: Segmentation fault STACK TRACE:

#0 (dbghelp: debug_write_backtrace+0xb5@0,000,7FF,763,E2D,945[cataclysm-tiles.exe+0x5cd,945]), #1 (dbghelp: log_crash+0x377@0,000,7FF,763,DF3,417[cataclysm-tiles.exe+0x593,417]), #2 (dbghelp: signal_handler+0x57@0,000,7FF,763,DF3,9A7[cataclysm-tiles.exe+0x593,9a7]), #3 (dbghelp: seh_filter_exe+0x178@0,000,7FF,765,2EB,A20[cataclysm-tiles.exe+0x1,a8b,a20]), #4 (dbghelp: `__scrt_common_main_seh'::`1'::filt$0+0x16@0,000,7FF,765,516,212[cataclysm-tiles.exe+0x1,cb6,212]), #5 (dbghelp: _C_specific_handler+0xa0@0,000,7FF,765,2BC,7F4[cataclysm-tiles.exe+0x1,a5c,7f4]), #6 (dbghelp: _chkstk+0x11f@0,000,7FF,FFF,892,47F[ntdll.dll+0xa2,47f]), #7 (dbghelp: RtlRaiseException+0x484@0,000,7FF,FFF,841,4F4[ntdll.dll+0x51,4f4]), #8 (dbghelp: KiUserExceptionDispatcher+0x2e@0,000,7FF,FFF,890,F8E[ntdll.dll+0xa0,f8e]), #9 (dbghelp: item_contents::has_pocket_type+0xf@0,000,7FF,764,DBF,1CF[cataclysm-tiles.exe+0x1,55f,1cf]), #10 (dbghelp: unload_activity_actor::unload+0x46@0,000,7FF,764,7B6,7C6[cataclysm-tiles.exe+0xf56,7c6]), #11 (dbghelp: player_activity::do_turn+0xfa6@0,000,7FF,764,311,366[cataclysm-tiles.exe+0xab1,366]), #12 (dbghelp: do_turn+0x755@0,000,7FF,763,E35,2D5[cataclysm-tiles.exe+0x5d5,2d5]), #13 (dbghelp: WinMain+0xc55@0,000,7FF,763,CBE,975[cataclysm-tiles.exe+0x45e,975]), #14 (dbghelp: __scrt_common_main_seh+0x106@0,000,7FF,765,2B9,42E[cataclysm-tiles.exe+0x1,a59,42e]), #15 (dbghelp: BaseThreadInitThunk+0x14@0,000,7FF,FFE,F47,614[KERNEL32.DLL+0x17,614]), #16 (dbghelp: RtlUserThreadStart+0x21@0,000,7FF,FFF,842,6F1[ntdll.dll+0x52,6f1]),
metiscus commented 1 year ago

So I think I have isolated the lines in the save file that were causing it and generated a save file that will load. The stored "activity" for the player was referencing an item in the player's inventory that didn't exist or something. I don't have debug capability right now but replacing

"activity": { "type": "ACT_UNLOAD", "actor": { "actor_type": "ACT_UNLOAD", "actor_data": { "moves_total": 113, "target": { "idx": 0, "type": "in_container", "parent": { "idx": 0, "type": "in_container", "parent": { "type": "character", "character": 1, "idx": 44 } } } } }, "moves_total": 113, "moves_left": 41, "interruptable": true, "interruptable_with_kb": true, "index": 0, "position": 0, "coords": [], "coord_set": [], "name": "", "targets": [], "placement": [ 0, 0, 0 ], "relative_placement": [ 0, 0, 0 ], "values": [], "str_values": [], "auto_resume": false, "monsters": [] }, With this "activity": { "type": "ACT_NULL" }, Results in a save file that loads despite a few warnings about items not fitting in various pockets etc. Probably what happened is an autosave hit during the unload and then somehow data updated and caused an item to be removed on startup or converted in some way so the unload references a bad spot and crashes.

Anyway, @Euvinl I have attached a zip file to this reply that fixes your save file. Hopefully that helps you get back playing and maybe also helps the engineers fix the underlying bug.

#Um9iaW4gSG9vZA==.zip

Euvinl commented 1 year ago

Thank you a lot for your time! I recall seeing issues about auto-save during unloading, hopefully this can be fixed for the next stable version.

metiscus commented 1 year ago

I wouldn't complete the task because there is still a crash that someone needs to fix.