Bug: Crash happening upon monster death

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CunningGabe
    Swordsman
    • Feb 2008
    • 250

    #31
    Originally posted by Max Stats
    I am also curious that I didn't see the "Compacting objects..." message before this bug. In fact, I don't recall ever seeing this message in recent times. That being said, this theory makes a lot of sense, given that make_object seems pretty robust about not creating objects will null kind, and the bug normally takes a long time to manifest. I guess the best way to go is to drastically lower the threshold for compacting objects and create lots of monsters that steal/pick up objects.
    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.

    Comment

    • Max Stats
      Swordsman
      • Jun 2010
      • 324

      #32
      OK, now it makes even more sense than before.
      If beauty is in the eye of the beholder, then why are beholders so freaking ugly?

      Comment

      • d_m
        Angband Devteam member
        • Aug 2008
        • 1517

        #33
        Originally posted by CunningGabe
        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?
        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.
        linux->xterm->screen->pmacs

        Comment

        • CunningGabe
          Swordsman
          • Feb 2008
          • 250

          #34
          Originally posted by d_m
          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 did modify the compacting code for mimics, but I'll double-check.

          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

          • myshkin
            Angband Devteam member
            • Apr 2007
            • 334

            #35
            Originally posted by d_m
            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.
            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.

            Comment

            • CunningGabe
              Swordsman
              • Feb 2008
              • 250

              #36
              Originally posted by myshkin
              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.
              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

              • CunningGabe
                Swordsman
                • Feb 2008
                • 250

                #37
                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

                • myshkin
                  Angband Devteam member
                  • Apr 2007
                  • 334

                  #38
                  Originally posted by CunningGabe
                  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.
                  Excellent! I've merged your fix to staging.

                  Comment

                  Working...
                  😀
                  😂
                  🥰
                  😘
                  🤢
                  😎
                  😞
                  😡
                  👍
                  👎