New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cataclysm can segfault when interrupted butchering is resumed #26113
Comments
command sequence to reproduce the crash: |
I think this is the activity being resumed in the save:
|
...and what the heck is multibutchering? |
It's an action to butcher everything on a tile.
|
I couldn't understand the entire process, but I've noticed the following when going through the code with gdb: |
The activity resume feature seems to be not finished at all.
Not sure if this is even reliably doable without unique item ids because |
We could also store data regarding unfinished activity on the corpse item itself with item->set_var. |
Thanks for the great details everyone, I'm pretty sure you solved it and I'm just picking up the pieces. |
Describe the bug
I looked into this a bit a while back, so I'm going from memory as to the nature of the issue and how Cataclysm deals with it. Sorry for the lack of specific details, but I just managed to obtain a problem-reproducing saved world and wanted to get the bug filed, as I understand that there is an upcoming release.
Cataclysm can segfault when butchering is interrupted, then resumed. The problem, as I recall, is that Cataclysm records the index of the corpse being butchered. However, this index is not guaranteed to remain valid from the time that the butchering is interrupted to the time that the butchering is resumed; other items can wind up in the grid square, potentially causing the index to refer to a non-corpse item. The invalid index can be saved with the character and the crash will persist across invocations of Cataclysm.
I tend to see this when butchering a corpse, being interrupted by a monster nearing, backing off the corpse, killing the monster on the same grid square, walking forward to try to resume butchering and having the game crash.
While I have not tested to confirm this, I suspect that, additionally, if an index is saved in the character's save file and there are multiple characters being played in the game world, that if one character is interrupted, has his game saved, another player is played in the world and mutates it, then it may similarly invalidate the index of the interrupted action.
Given the latter multiple-character situation, if resumable butchering is to be retained and done properly, it might be necessary to attach a UUID to each item (or at least each item referenced by a player's save file), something that would permit player references to items in the world to remain valid while the world mutates. Given that this would change the world save format, I'd imagine that it warrants developer discussion.
To Reproduce
I'm attaching an options.json (for autobutchering) and save directory for Cataclysm hashref a36162e that permits the crash to be easily induced -- simply move one step to the northeast and the game will crash. A stack trace from such a repro:
Expected behavior
I'd expect butchering to resume without the game crashing.
Screenshots
N/A
Versions and configuration(please complete the following information):
Additional context
Add any other context about the problem here.
E.g. A link to a savegame that allows the issue to be reproduced.
save.tar.gz
options.json.gz
The text was updated successfully, but these errors were encountered: