Author Topic: Died when polymorphed server crash  (Read 478 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Died when polymorphed server crash
« on: November 30, 2010, 08:25:10 pm »


               This is not my server where it is going on, but from what I know they running on linux (debian), using quite older version of NWNX with only odbc plugin.

At most time, when particular player die in polymorph, server crash. He has build 6druid 10 shifter 24DD and so far it crashed in various shapes, Risen Lord and Illithid from what I have seen. First we thought it has connection with buggy defensive stance, but not. Now it appear that it is because of constitution bonus on item. He has +5 con belt, which merges in those two shapes. There were more shifters but none of them crashed server yet, but I believe that they haven't anything with constitution. And dragons do not certainly, as they merges only armor and there are not such items with con bonus.

Well anyone saw this issue? Kind of major for them and they asked me to fix it. So far didn't started, was hoping someone already found the solution for this.
               
               

               


                     Modifié par ShaDoOoW, 30 novembre 2010 - 08:25 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #1 on: November 30, 2010, 09:45:39 pm »


               We had an issue like this a couple years back, but I'll be damned if I can remember the root cause. One issue we had for certain was conflicting code in onequip or onacquire. I also remember a definite conflict with our old invisible helms code - are you using invisible helms? The first thing I'd recommend is our item event debug code in all related events (un/equip, un/acquire), like so (this is what helped us narrow the problem down). We use a chat command to set the local checked for, and just leave this code in our event at all times (it's incredibly handy to be able to turn it on on a whim):


    if (GetLocalInt(oPC, "DebugItemEvents")) {
        object oArea = GetArea(oPC);

        SendMessageToPC(oPC, COLOR_WHITE + "Item Event: Unequip" +
            ", Owner: " + GetName(oPC) + " (" + GetObjectString(oPC) +
            "), Area: " + GetName(oArea) + " (" + GetObjectString(oArea) +
            "), Item: " + GetName(oItem) + " (" + GetObjectString(oItem) +
            ") [x" + IntToString(GetItemStackSize(oItem)) + "]" +
            ", Force: " + IntToString(GetLocalInt(oPC, "ForceUnequipped")) +
            ", Poly: " + IntToString(GetLocalInt(oPC, "MidPolymorph")) +
            COLOR_END);
    }

    if (GetLocalInt(oLoser, "DebugItemEvents")) {

        if (!GetIsObjectValid(oPossessor))
            oPossessor = GetArea(oItem);

        SendMessageToPC(oLoser, COLOR_WHITE + "Item Event: Unacquire" +
            ", Loser: " + GetName(oLoser) + " (" + GetObjectString(oLoser) +
            "), Possessor: " + GetName(oPossessor) + " (" + GetObjectString(oPossessor) +
            "), Item: " + GetName(oItem) + " (" + GetObjectString(oItem) +
            ") [x" + IntToString(GetItemStackSize(oItem)) + "]" + COLOR_END);
    }

    if (GetLocalInt(oPC, "DebugItemEvents")) {
        SendMessageToPC(oPC, COLOR_WHITE + "Item Event: Equip" +
            ", Owner: " + GetName(oPC) + " (" + GetObjectString(oPC) +
            "), Area: " + GetName(oArea) + " (" + GetObjectString(oArea) +
            "), Item: " + sItemName + " (" + GetObjectString(oItem) +
            ") [x" + IntToString(GetItemStackSize(oItem)) + "]" + COLOR_END);
    }

    if (GetLocalInt(oAcquire, "DebugItemEvents")) {
        SendMessageToPC(oAcquire, COLOR_WHITE + "Item Event: Acquire" +
            ", Acquirer: " + GetName(oAcquire) + " (" + GetObjectString(oAcquire) +
            "), Loser: " + GetName(oLoser) + " (" + GetObjectString(oLoser) +
            "), Item: " + GetName(oItem) + " (" + GetObjectString(oItem) +
            ") [x" + IntToString(GetItemStackSize(oItem)) + "]" + COLOR_END);
    }

If you want any of the subfunctions, let me know, though the real major thing is simply knowing where it's seizing up. Looking at the first of those above jogged my memory - see the MidPolymorph int? It's set iin our scripts whenever a pc is polymorphed (including shifting), by means of this function:


void ApplyPolymorphEffect (int nDurType, effect ePoly, object oTarget, float fDur=0.0) {
    if (GetLocalInt(oTarget, "NoPoly"))
        return;

    SetLocalInt(oTarget, "MidPolymorph", TRUE);
    ApplyEffectToObject(nDurType, ePoly, oTarget, fDur);
    DeleteLocalInt(oTarget, "MidPolymorph");
}

Both onequip and onunequip return nearly immediately if that int is set, to avoid conflicts. Onequip is immediate:


void main() {
    object oPC = GetPCItemLastEquippedBy();

    if (GetLocalInt(oPC, "MidPolymorph") || (ScanForPolymorphEffect(oPC) > -2))
        return;
<snip>


and unequip nearly immediately, awaiting only debug::


void main() {
    object oPC = GetPCItemLastUnequippedBy();
    object oItem = GetPCItemLastUnequipped();

    if (GetLocalInt(oPC, "DebugItemEvents")) {
        object oArea = GetArea(oPC);

        SendMessageToPC(oPC, COLOR_WHITE + "Item Event: Unequip" +
            ", Owner: " + GetName(oPC) + " (" + GetObjectString(oPC) +
            "), Area: " + GetName(oArea) + " (" + GetObjectString(oArea) +
            "), Item: " + GetName(oItem) + " (" + GetObjectString(oItem) +
            ") [x" + IntToString(GetItemStackSize(oItem)) + "]" +
            ", Force: " + IntToString(GetLocalInt(oPC, "ForceUnequipped")) +
            ", Poly: " + IntToString(GetLocalInt(oPC, "MidPolymorph")) +
            COLOR_END);
    }

    /* scripts in onequip, onunequip, onunacquire - script here MUST be before
     * the "ForceUnequipped" int is deleted below */
    if (GetLocalInt(oPC, "MidPolymorph") || (ScanForPolymorphEffect(oPC) > -2))
        return;
<snip>

I suspect just that will alleviate the crash problem, but again, I'm going off extremely fuzzy recollections, and it's not particularly easy to troubleshoot code involving 5 different types of events (including the initial shift). One reason for the ordering is our custom ILR system, which uses a ForceUnequipped int to indicate an item in the process of being unequipped, so if the server in question is using scripted ILR of some kind, that's definitely a red flag.

With invisible helms, there was a related crash issue, caused, iirc, by some kind of infinite un/equip loop (item props of 'invisible' helms were stored on skins, tricksy when you involve shifters).

Hopefully that will provide you a few leads to hunt down. Good luck, and let me know if you have any questions.

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #2 on: November 30, 2010, 10:54:59 pm »


               if you suspect a script you could try script logging to see if it always crashes on the same script.



- Added new nwnplayer.ini file setting to log each script as it executes (defaults to off). Enabling this will degrade game performance. It should only be used for script debugging purposes (i.e. when you have a bad script that causes your module to lock up, checking the log file will let you know the last script that executed).

   [Script Options]

   Enable Logging=1


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #3 on: December 01, 2010, 06:00:18 am »


               Nope i dont suspect any script, I suspect that this is general. As I said its not my script, I cant debug it, I dont have access to logs, but they told me, that the last thing they found in logs was that shifter's death. No invisible helms workaround, in On(un)Equip there is only few lines of code. One from me to copy onhit properties from ranged weapon to ammo, second one is special ILR for special items for X levels of classes. The shifter in question doesnt have any of them.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #4 on: December 01, 2010, 08:12:17 am »


               Actually, you said it wasn't your server. You didn't say anything about not having access to the scripts or debug. They're expecting you to fix it without the module? Heh. Good luck with that. '<img'>

Anyway, one other shifter crash issue comes to memory. If a shifter deshifts when doing so would kill them, it used to cause a crash on our server. We fixed this by forcing players to use a chat command to unshift, blocking shifting while shifted (not particularly popular, but necessary, for reasons I don't recall, and which might or might not be specific to HG), and checking hp before unshifting. You might get away with just checking before the unshift. Here's the code for our !cancel poly command, in case it helps:


                } else if (sCancel == "poly") {

                    int nHP = 20 + (GetAbilityModifier(ABILITY_CONSTITUTION, oCPC) * GetHitDice(oCPC));

                    if (GetCurrentHitPoints(oCPC) < nHP)

                        FloatingTextStringOnCreature(COLOR_RED + "Unshifting now would kill you!" + COLOR_END, oCPC, FALSE);

                    else if (RemoveEffectsOfType(EFFECT_TYPE_POLYMORPH, oCPC, oCPC) > 0)

                        AssignCommand(oCPC, ClearAllActions());

                    return;

                }

There are other possible causes, I suppose, but without the ability to run debug, it's difficult to the point that it's just not worth my time. Here's to hoping it's the above issue...not quite what you described, but related.

Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #5 on: December 01, 2010, 02:53:05 pm »


               

FunkySwerve wrote...

Actually, you said it wasn't your server. You didn't say anything about not having access to the scripts or debug. They're expecting you to fix it without the module? Heh. Good luck with that. '<img'>

Yea exactly ':lol:'

EDIT: well more specifically, they want to disallow that player to play his character, Im trying to help that player, DMs there do not care about that bug so much, ´for them banning the Shifter class is easier solution. I promised them to fix it, but they won't give me any help except sending me the scripts I will ask for. And I already have On(Un)Equip because of the bow onhit fix I made for them. Should I post it here? I don't see anything there.
               
               

               


                     Modifié par ShaDoOoW, 01 décembre 2010 - 02:57 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #6 on: December 01, 2010, 05:18:17 pm »


               That it appears linked to the Con item makes me suspect it is indeed some hp-related issue. Perhaps the loss of additional hp after dead...hard to say. Makes me wonder if they're using Iznoghoud's or some other variant of shifter scripts. Post the fix if you like, but I doubt you'll find anything without debug.



Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #7 on: December 03, 2010, 11:31:00 am »


               Ok its very probably general bug. My single player game just crashed when died and respawned with different shifter build, but with +6con boots.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #8 on: December 03, 2010, 06:01:04 pm »


               Was it on respawn that the crash occurred, or on death?



Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #9 on: December 03, 2010, 06:44:45 pm »


               it crashed in the moment I clicked on respawn button. Well might not be related, but it would be a big coincidence, just for the fact my single player game never crashed yet since 1.69.



well ok, im not just big SP modules player, but still
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #10 on: December 03, 2010, 08:19:06 pm »


               I asked acaos about this, who was the one who worked up our fix. This is in fact why we have the !cancel poly setup and the ban on shifting direct from form to form without unshifting in between. He didn't go into specifics:

Funky: hey, did you ever figure out the specifics of the con item shifter crash? is that the reason we have the !cancel poly command, or was that another issue, the crash caused by shifting while shifted?
acaos: it's the reason we have !cancel poly yes
acaos: the two issues are related

Basically, the fix for this is extensive - my guess is the server will likely just ban shifters. Tell him to play HG instead, we have some seriously awesome modifications to shifters. '<img'>

Begin shameless plug:
screenshots


[u]Shifter[/u]
- All Wyrmlings can use Inflicting Breath, except Green which receives Weakening Breath.
- Dragon Shape now offers White Dragon and Silver Dragon with HG Enhanced.
- All dragons can use Dragon Breath and Wing Buffet.
- Greater Wildshape 2 now offers Fairy and Troll with HG Enhanced.
- Gargoyle receives improved defenses.
- Harpy can use Harpy Song.
- Minotaur can use Rage and Maze.
- Fairy can use Spill Potion and Mock.
- Troll receives enhanced regeneration.
- Greater Wildshape 3 now offers Wyvern and Xorn with HG Enhanced.
- Basilisk can use Death Gaze.
- Drider cannot be knocked down and can use Darkness, Web, and Magic Missiles.
- Manticore can use Manticore Spikes.
- Wyvern can use Poison Sting and Wyvern Snatch.
- Xorn can petrify on hit.
- Greater Wildshape 4 now offers Beholder and Gelatinous Cube with HG Enhanced.
- Dire Tiger can use Knockdown Pounce.
- Medusa can use Petrification Gaze.
- Mind Flayer can use Mind Blast.
- Beholder can use Antimagic Cone, Inflict Ray, and Freeze Ray.
- Gelatinous Cube can use Gelatinous Disarm.
- Humanoid Shape now offers Kenku and Sahuagin with HG Enhanced.
- Drow can use Body Adjustment, Darkness and Mortal Strike.
- Kobold can use Body Adjustment, Set Trap, and receives scaling Sneak Attack.
- Lizardfolk can use Body Adjustment and receives Lash of Hatred abilities.
- Kenku can levitate, uses a bow, and can use Body Adjustment.
- Sahuagin can breathe water and can use Body Adjustment and Web.
- Many Druid and Shifter forms have received upgrades, and most equipment now functions while shifted.
- Unarmed weapon focus feats now benefit armed forms while shifted.
-
 Characters with the Wild Shape feat may take Weapon Specialization and
Epic Weapon Specialization in creature weapons in legendary levels.
- Outsider Shape now offers Modron and Leonal with HG Enhanced.
- Azer can use Burning Hands, Fire Blast, and Fire Protection Aura.
- Death Slaad can use Chaos Spittle and Anti-Confusion Aura.
- Rakshasa can use Ice Storm, Acid Breath/Great Thunderclap, and Dispel Magic/Area Spell Breach.
- Modron uses a crossbow and can use Construct Wall, Immobilization Trap, and Coruscating Beam Trap.
- Leonal can use Fear Howl, Anti-Fear Aura and Rage.
- Shifters have been completely reworked. See the full documentation for details.
- Shifters in Construct Shape are immune to amnesia effects.
- Construct Shape now offers Crystal Golem and Marut with HG Enhanced.
- Demonflesh Golem can use Rage, Infesting Touch, and Focused Immunity.
- Iron Golem can use Poison Breath and Crumple Armor.
- Stone Golem can use Hurl Rock and Siege Mode.
- Crystal Golem can use Prismatic Spray and Daze Aura.
- Marut can use Grappling Chain and Lightning Pulse.
- Shifters receive a damage bonus similar to Lore from the Animal Empathy skill.
- Undead Shape now offers Baelnorn and Banshee with HG Enhanced.
- Risen Lord can slay on hit and is inherently immune to Breach.
- Spectre can use Shadow Touch and Bestow Curse.
- Vampire can use Domination Gaze.
- Baelnorn can use Positive Energy Strike, Sunburst, and Empower Ally.
- Banshee can use Howl of Death, Sonic Howl, and Fear Aura.

Funky
               
               

               


                     Modifié par FunkySwerve, 03 décembre 2010 - 08:20 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Died when polymorphed server crash
« Reply #11 on: December 03, 2010, 08:22:50 pm »


               On a more serious note, you could probably stop this particular issue by blocking anyone wearing con gear from shifting (blocking shifter leveled-characters wouldn't cut it, since there's still polymorph), though that would NOT block all crashes, just the large majority of them, if memory serves.



Funky