Menu

#4071 NPE at Grounded Dropship's Weapon Phase on Megamek 0.37.8 - dev

stable 0.38
closed
None
fixed
1
2014-04-10
2014-03-14
anton1976id
No

Partial Quote from Megamek log:

java.lang.NullPointerException
at megamek.server.Server.entityUpdate(Server.java:25563)
at megamek.server.Server.entityUpdate(Server.java:25515)
at megamek.server.Server.destroyEntity(Server.java:24265)
at megamek.server.Server.destroyEntity(Server.java:23990)
at megamek.server.Server.destroyEntity(Server.java:23969)
at megamek.server.Server.damageEntity(Server.java:19913)
at megamek.common.weapons.WeaponHandler.handleEntityDamage(WeaponHandler.java:965)
at megamek.common.weapons.BayWeaponHandler.handle(BayWeaponHandler.java:319)
at megamek.server.Server.handleAttacks(Server.java:31455)
at megamek.server.Server.endCurrentPhase(Server.java:2530)
at megamek.server.Server.changeToNextTurn(Server.java:2841)
at megamek.server.Server.endCurrentTurn(Server.java:1962)
at megamek.server.Server.receiveAttack(Server.java:11436)
at megamek.server.Server.handle(Server.java:27367)
at megamek.server.Server$1.packetReceived(Server.java:351)
at megamek.common.net.AbstractConnection.processConnectionEvent(AbstractConnection.java:608)
at megamek.common.net.AbstractConnection.processPacket(AbstractConnection.java:512)
at megamek.common.net.AbstractConnection.update(AbstractConnection.java:459)
at megamek.server.Server.run(Server.java:27565)
at java.lang.Thread.run(Unknown Source)

2 Attachments

Discussion

  • Dylan Myers

    Dylan Myers - 2014-03-14
    • Resolution: none --> duplicate
    • Milestone: undetermined --> stable 0.38
     
  • Dylan Myers

    Dylan Myers - 2014-03-14

    This is a duplicate of an already known and open bug, however when trying to open the main bugs page I am currently getting an error so I cannot find the original bug at this time.

     
  • Dylan Myers

    Dylan Myers - 2014-03-14
    • Resolution: duplicate --> accepted
     
  • Dylan Myers

    Dylan Myers - 2014-03-14

    Ok, found the old bug. It's [#3766]. Not the same issue after all, so switching from duplicate to accepted.

     

    Related

    Bugs: #3766

  • Nicholas Walczak

    The code that is throwing this exception has been changed, but I went back to [r10597], when 37.8 was created, and got the code. The problematic code looks like this:

     for (Entity eLoaded : eTarget.getLoadedUnits()) {
       pack = createEntityPacket(eLoaded.getId(), null);
    

    Which, must mean that a unit is loading a null Entity. This is something we've been encountering in the client, but I had assumed it was causing by issues sending updates to the client. Apparently it's not. We'll have to figure out how null entries are getting loaded into an Entity.

     

    Related

    Commit: [r10597]


    Last edit: Nicholas Walczak 2014-03-15
  • Nicholas Walczak

    Well, this was fun. It's fixed in [r10678].

    So, what was happening is that there was a Dropship that was loaded with a number of 'mechs that was being destroyed. In Server.destroyEntity, if you've got an Aero that is being destroyed, there's a survival check for units. What was happening is that Entity's that were destroyed were being removed from the game, however they were not being removed as units loaded in the dropships.

    What would happen is that then when the Server.entityUpdate for the Dropship was performed the Dropships was transporting entity ids that had been removed from the Game object, and when their Entity instance was retrieved a null value was returned, which ended up causing a crash.

    I added some code to Server.destroyEntity that unloads destroyed units during the survival check.

     

    Related

    Commit: [r10678]

  • Nicholas Walczak

    • assigned_to: Nicholas Walczak
    • Resolution: accepted --> fixed
     
  • Nicholas Walczak

    • Status: open --> closed
     

Log in to post a comment.