There are two kinds of compacting. One is where the game actually destroys some objects in order to make room -- that's when you see the "Compacting objects" message. The other is when the game just scans through the item list, and moves items around so that there are no more holes in the list. It's this latter kind of compacting that I've observed right before the bug.
Bug: Crash happening upon monster death
Collapse
X
-
-
Gabe, thanks! I think you are definitely on the right track.I'm getting close. The problem seems to be with compacting objects and monster inventories. I don't have time to track it down completely right now, but it seems that after compact_objects(0) is called, then some monsters are left with references to dead objects. Maybe there's a fencepost error somewhere, so that everything in monster inventory except for one object is updated correctly?
I just managed to trigger this error (with a playtesting character) in GDB. So now I have a core dump and a debugger attached.
In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.
I will check this myself, but just wanted to ask in case you knew offhand.Comment
-
I did modify the compacting code for mimics, but I'll double-check.Gabe, thanks! I think you are definitely on the right track.
I just managed to trigger this error (with a playtesting character) in GDB. So now I have a core dump and a debugger attached.
In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.
I will check this myself, but just wanted to ask in case you knew offhand.
I've been trying to debug by summoning lots of cutpurses and watching the item compacting behavior. It seems that sometimes, randomly, a monster thinks its holding nothing, even very soon after it picks something up. I'm still trying to track down why, however.Comment
-
compact_objects_aux() did not correctly update the mimicked_o_idx member for mimic m_ptrs. I have fixed this and pushed the change to staging, but am not certain that all paths to the o_ptr->kind crash are closed.In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.Comment
-
Thanks for fixing that. I can confirm, however, that I can still get the crash by killing a bunch of cutpurses. I just started a new character, used debug commands to outfit myself and jumped to DL50. I then 'z'apped all the enemies away and just started summoning and killing cutpurses.
Edit: As an added sanity check, I reverted to before the mimic stuff was committed, and was able to get a crash in the same way. Which is sad, because the bug is still at large, but relieving, because it's not entirely my fault
Last edited by CunningGabe; July 3, 2011, 00:53.Comment
-
I think what is happening somehow is that an object thinks it is held by a monster other than the one it is held by. (That is, o_ptr->held_m_idx is incorrect.) Then, when the object is moved in the object list, the monster that is actually holding it doesn't get the update, and so the index it has ends up referring to a possibly empty object.
I checked the monster compacting to make sure that it updates o_ptr->held_m_idx appropriately, and it seems that it does. Still trying to look for the problem...
Edit: Found it! Monsters know their own monster index, but the monster compacting code wasn't updating that index. I'll put up a fix now.Last edited by CunningGabe; July 3, 2011, 21:10.Comment
Comment