[3.5-dev] Reproducing chaos/polymorph crash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • molybdenum
    Apprentice
    • May 2013
    • 84

    [3.5-dev] Reproducing chaos/polymorph crash

    You can reproduce easily by summoning a chaos breather and a bunch (20+) of monsters. As long as the monster pack stays dense, a crash should occur. You can also just zapping a wand of polymorph at things until it happens.

    The issue is actually in project_m(), which includes a notice at the top about polymorph crashes. In the first above case, this is what seems to be happening:
    - chaos breather triggers random polymorph on another monster
    - place_new_monster_one() (by way of place_new_monster()) can't place the monster in the location it wants to, so it returns false
    - m_ptr is null, since cave_monster_at() doesn't return a monster
    - mon_clear_timed() (only in the who > 0 branch) crashes because m_ptr is null

    In the second case, the first three steps are the same. The crash just occurs when the check for dam > m_ptr->hp is made in the else branch of who > 0.
  • Derakon
    Prophet
    • Dec 2009
    • 9022

    #2
    Why can't place_new_monster_one() place a monster? Because the target monster is still in place?

    Sorry, I shouldn't be asking questions when you've already provided a lot of helpful information. Thanks for the debugging!

    Comment

    • molybdenum
      Apprentice
      • May 2013
      • 84

      #3
      Originally posted by Derakon
      Why can't place_new_monster_one() place a monster? Because the target monster is still in place?
      Specifically, in my cases, it was because cave_isopen() returned false. I was doing this in fairly open rooms or in town, but I suppose there could have been something on the ground that I didn't pay attention to. Also, plenty of monsters were polymorphed successfully, so it's not happening all the time. I also think that I've had polymorph crash when IDing a wand in a corridor against a single monster.

      Comment

      • PowerWyrm
        Prophet
        • Apr 2008
        • 2986

        #4
        Originally posted by molybdenum
        You can reproduce easily by summoning a chaos breather and a bunch (20+) of monsters. As long as the monster pack stays dense, a crash should occur. You can also just zapping a wand of polymorph at things until it happens.

        The issue is actually in project_m(), which includes a notice at the top about polymorph crashes. In the first above case, this is what seems to be happening:
        - chaos breather triggers random polymorph on another monster
        - place_new_monster_one() (by way of place_new_monster()) can't place the monster in the location it wants to, so it returns false
        - m_ptr is null, since cave_monster_at() doesn't return a monster
        - mon_clear_timed() (only in the who > 0 branch) crashes because m_ptr is null

        In the second case, the first three steps are the same. The crash just occurs when the check for dam > m_ptr->hp is made in the else branch of who > 0.
        The error comes from place_new_monster_one() where a check is made against cave_isempty() while it should be cave_isopen(). There is no reason not to place a monster on top of an object.
        PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

        Comment

        • molybdenum
          Apprentice
          • May 2013
          • 84

          #5
          Originally posted by PowerWyrm
          The error comes from place_new_monster_one() where a check is made against cave_isempty() while it should be cave_isopen(). There is no reason not to place a monster on top of an object.
          Yeah, I actually did more testing this weekend and changed that. It's waiting in a pull request.

          Comment

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