Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call Pet ( on Dead Pet ) Server Crashed #5400

Closed
Mosoo opened this issue Feb 24, 2012 · 63 comments
Closed

Call Pet ( on Dead Pet ) Server Crashed #5400

Mosoo opened this issue Feb 24, 2012 · 63 comments

Comments

@Mosoo
Copy link

Mosoo commented Feb 24, 2012

Revision : cdc85bb
TDB 46 Updated

With a Hunter , When Your Pet is Dead ( And Is not Spawned ) Try to Use Spell : Call Pet > Server Crashed

Call Stack Here > worldserver.exe!MotionMaster::InitTop() Line 601 + 0x7 bytes C++

(Win32, Debug)
http://paste2.org/p/1914692

http://129.7.img98.net/out.php/i225918_screen.jpg

@Star-lion
Copy link
Contributor

theres something called paste2.org use it

@Expecto
Copy link

Expecto commented Feb 24, 2012

use RelwithDebInfo

@Subv
Copy link
Contributor

Subv commented Feb 24, 2012

Stupid crashlog is stupid

@Mosoo
Copy link
Author

Mosoo commented Feb 24, 2012

Unflagged 3984 0 Worker Thread Win32 Thread _threadstartex Normal
Unflagged 5568 0 Main Thread Main Thread ACE_OS::thr_join Normal
Unflagged 3312 0 Worker Thread ACE_Thread_Adapter::invoke ACE_OS::cond_wait Normal
Unflagged 3256 0 Worker Thread ACE_Thread_Adapter::invoke ACE_OS::cond_wait Normal
Unflagged 4732 0 Worker Thread ACE_Thread_Adapter::invoke ACE_OS::cond_wait Normal
Unflagged > 2892 0 Worker Thread ACE_Thread_Adapter::invoke MotionMaster::InitTop Normal
Unflagged 2304 0 Worker Thread ACE_OS_Thread_Adapter::invoke ACE_Activation_Queue::enqueue Normal
Unflagged 3836 0 Worker Thread Win32 Thread malloc Normal
Unflagged 4564 0 Worker Thread ACE_Thread_Adapter::invoke ACE_Token::shared_acquire Normal

  •   this    0x00000000 {_expList=[...]() Impl=0x00000004 _top=??? ...}  MotionMaster \* const
    _expList    [...]() std::vector<MovementGenerator *,std::allocator<MovementGenerator *> > *
    
  •   Impl    0x00000004  MovementGenerator \* [3]
    [0] CXX0017: Error: symbol "" not found 
    [1] CXX0030: Error: expression cannot be evaluated  
    [2] CXX0030: Error: expression cannot be evaluated  
    _top    CXX0030: Error: expression cannot be evaluated  
    _owner  CXX0017: Error: symbol "" not found 
    
  •   _needInit   0x00000018  bool [3]
    [0] CXX0030: Error: expression cannot be evaluated  
    [1] CXX0030: Error: expression cannot be evaluated  
    [2] CXX0030: Error: expression cannot be evaluated  
    _cleanFlag  CXX0030: Error: expression cannot be evaluated  
    

that's what you need ?

void MotionMaster::InitTop()
{
top()->Initialize(*_owner);
_needInit[_top] = false;
}

@Mosoo
Copy link
Author

Mosoo commented Feb 24, 2012

@oceanor
Copy link

oceanor commented Feb 24, 2012

same here, calling dead pets will cause instacrash by top() of MotionMaster::InitTop()

@Subv
Copy link
Contributor

Subv commented Feb 24, 2012

need to call MotionMaster::Initialize somewhere before the motion master is used, i suggest adding it in the Unit class constructor

@yashirotcm
Copy link

Confirming this, error reproduces on call a dead pet

@yashirotcm
Copy link

My related crash dump paste for whatever is worth:

http://pastebin.com/R49XT6W3

@MrSmite
Copy link
Contributor

MrSmite commented Feb 26, 2012

Why not just stop using Call Pet on dead pets and use Revive Pet as intended? ;)

@Mosoo
Copy link
Author

Mosoo commented Feb 26, 2012

MrSmite When Your Pet is Spawned and is Dead Everything is Fine and you can revive pet .

but it's impossible to revive IT when your pet isn't spawned :)

@ghost
Copy link

ghost commented Feb 29, 2012

Maybe this should get priority:critical ?
because it leads to de facto unplayable hunters/ hunters crashing servers on constant basis

@Mosoo
Copy link
Author

Mosoo commented Feb 29, 2012

Agree
But instead of solving the problems they are just thinking about the new features

@MrSmite
Copy link
Contributor

MrSmite commented Feb 29, 2012

"MrSmite When Your Pet is Spawned and is Dead Everything is Fine and you can revive pet .
but it's impossible to revive IT when your pet isn't spawned :)"

Ok, well you didn't say anything about the pet not being spawned. You simply said "dead".

While I agree we should fix Call Pet to not crash the server, I don't think it should be "hacked" to work on dead pets wether spawned or not.

In the interim, you should be telling your players to submit tickets and not use call pet. Tell them if they crash the server too many times they will be banned. Your GM can fix the pet in the DB so the next time they log in it can be called properly.

@Mosoo
Copy link
Author

Mosoo commented Feb 29, 2012

at the moment best solution is to disable spell from disables table and tell them they need wait until it fixed .

@yashirotcm
Copy link

Also happens with Call stabled pet btw, so disable that too. and for some reason, after disabling both spells server keeps crashing, will post logs later.

@yashirotcm
Copy link

New crash log even with Call pet and Call Stabled pet disabled: http://pastebin.com/KCgfEU3w
Guys srsly Hunters are totally broken right now, I strongly suggest the staff to focus on this one. thanks.

@Warpten
Copy link
Member

Warpten commented Feb 29, 2012

the « staff », which, in fact, is anyone that contributes, will deal with this issue whenever any member of the staff, that is, anyone, will want to look on it and take time to fix that.

@chaosua
Copy link
Contributor

chaosua commented Mar 1, 2012

confirmed
TC rev: 03a7a80
03a7a80
OS: Win x64
Patches: none
backtrace http://pastebin.com/rkxU7Dih

TC rev: 03a7a80
OS: Fedora 32bit
Patches: WG, anticheat, etc ...

backtrace:
http://pastebin.com/9c0NXcKc
http://pastebin.com/LR1pznhJ

@dobrMAN
Copy link

dobrMAN commented Mar 2, 2012

confirm
TrinityCore rev. 2012-02-29 21:56:22 -0330 (c531cbc+) (Unix, Release)
OS: Ubuntu Server 10.10
Patches: None
backtrace: http://pastebin.ru/5ipvytG2

@MrSmite
Copy link
Contributor

MrSmite commented Mar 2, 2012

Looks like MotionMaster should be checking for a valid *owner:

/src/server/game/Movement/MotionMaster.cpp:601
601 top()->Initialize(*_owner);

Try changing this

void MotionMaster::InitTop()
{
    top()->Initialize(*_owner);
    _needInit[_top] = false;
}

to

void MotionMaster::InitTop()
{
    if (!_owner)
        return;

    top()->Initialize(*_owner);
    _needInit[_top] = false;
}

@Crusher55
Copy link

@MrSmite Your fix does not work.
I think its a problem with the fact that the pet is not in the world before it is called, thus if it died somewhere else the server will crash + if its dead.

@yashirotcm
Copy link

Just Tested MrSmite fix, no go, same crash:

Backtrace on Windows 7: http://pastebin.com/2zPDzVq9

@kaelima
Copy link
Contributor

kaelima commented Mar 2, 2012

The answer is here: "need to call MotionMaster::Initialize somewhere before the motion master is used..."

@Star-lion
Copy link
Contributor

it is something trying to use a null pointer im almost positive of.. oh

@Natureknight
Copy link

is there any fix already? Confirmed btw

@MrSmite
Copy link
Contributor

MrSmite commented Mar 2, 2012

@kaelima:

Right, I forgot about that statement...

@Subv
Copy link
Contributor

Subv commented Mar 2, 2012

@MrSmite Y U FORGET ME? U MAKE ME CRY!!!

@Viste
Copy link

Viste commented Mar 3, 2012

try changing this
void MotionMaster::InitTop()
{
top()->Initialize(__owner);
_needInit[_top] = false;
}
to
void MotionMaster::InitTop()
{
top()->Initialize(__owner);
_needInit[_top] = true;
}

@eilo
Copy link
Contributor

eilo commented Mar 4, 2012

@yashirotcm open the next file of your trinitycore: /src/game/Entities/Unit/Unit.cpp

Go to the line 249 and copy paste the next two lines BEFORE the "}" and AFTER "_targetLocked = false;"

// Prevent crash when loading dead pets or using call pet on dead pets
i_motionMaster.Initialize();

Thats all if you won't be able to apply the patch with command.

@MrSmite thanks for your work on pets :)

@yashirotcm
Copy link

Huh... after applying the patch i keep getting worldserver crashes when loading transports, anyone else with the same prob?, the crash log isnt showing anything even with Relwithdebinfo.

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

@yashirotcm: Hmm, rev: e1b544d causes this crash on my test box in release mode:

..\..\..\..\_src\src\server\game\AI\CreatureAISelector.cpp:105 in FactorySelector::selectMovementGenerator ASSERTION FAILED:
  creature->GetCreatureTemplate() != NULL

Now that I think about it, I used "attach to" an already running worldserver.exe so I missed the startup problem. I'll work on a fix.

@eilo: You're welcome. I played a Hunter on retail from original release to WotLK. They were my favorite class so I like to make sure they work as good as possible (to my ability anyway) in Trinity.

Played a Warlock too but only to level 40.

@Natureknight
Copy link

yashirotcm, mine crashes too :(

@Mosoo
Copy link
Author

Mosoo commented Mar 4, 2012

2012-03-03 20:24:27 ERROR:
D:\Core\TC\src\server\game\AI\CreatureAISelector.cpp:105 in FactorySelector::selectMovementGenerator ASSERTION FAILED:
creature->GetCreatureTemplate() != NULL
...

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

@Mosoo: Yep, I fixed that but then it crashed somewhere else related to Object.h... grr.

@yashirotcm
Copy link

Still crashes :P

http://pastebin.com/ef5UXW6Z

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

@yashirotcm: Yeah, still working on it. I was hoping I could delete the patch before anyone saw it. I had accidentally debugged the wrong revision which didn't have the patch so naturally it didn't crash :)

Just waiting for VS to compile...

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

Ok, this patch (plus the previous) does in fact work on rev: e1b544d

patch removed by MrSmite, causing too many new problems

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

To summarize:

removed by MrSmite, causing too many new problems

@Natureknight
Copy link

still crashing on me... sick

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

Hmm, strange. It crashes in a release build but not a debug build.

I'll have to look at it later, need to get some sleep.

@Erfa1l
Copy link
Contributor

Erfa1l commented Mar 4, 2012

@MrSmite, somewhere not initialized variable. In debug it initialized by default but not in release.

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

Yay! Finally a patch that works:

From ece5a5d6a522705808e23c92898d454183b8f336 Mon Sep 17 00:00:00 2001
From: MrSmite <no_mail@email.com>
Date: Sun, 4 Mar 2012 17:09:54 -0500
Subject: [PATCH] Fix crash using call pet on dead pets.

Fixes #5400
---
 src/server/game/Entities/Unit/Unit.cpp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index dbbb8ac..2100422 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12700,8 +12700,18 @@ void Unit::setDeathState(DeathState s)
         // remove aurastates allowing special moves
         ClearAllReactives();
         ClearDiminishings();
-        GetMotionMaster()->Clear(false);
-        GetMotionMaster()->MoveIdle();
+
+        if (!isPet() || (isPet() && IsInWorld()))
+        {
+            // Only clear MotionMaster for non-pet entities OR if pet and in world
+            // Fixes crash when:
+            //  * Using 'call pet' on dead pets
+            //  * Using 'call stabled pet'
+            //  * Logging in with dead pets
+            GetMotionMaster()->Clear(false);
+            GetMotionMaster()->MoveIdle();
+        }
+
         StopMoving();
         // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
         // do not why since in IncreaseMaxHealth currenthealth is checked
-- 
1.7.3.1.msysgit.0

@Subv
Copy link
Contributor

Subv commented Mar 4, 2012

what do you mean with "hopefully"...

@MrSmite
Copy link
Contributor

MrSmite commented Mar 4, 2012

@Subv: Nothing, I was just messing around which is why I removed that comment.

@Natureknight
Copy link

Yeah @MrSmite It works now! great :)

@yashirotcm
Copy link

@MrSmite OMG! I want your babies now!! I <3 You! it works! thank you so much!

@yashirotcm
Copy link

BAM!! Ingame crash again, but im not sure if it's related, can somebody look it up please?

http://pastebin.com/yH67HktB

@MrSmite
Copy link
Contributor

MrSmite commented Mar 5, 2012

Not related. Call pet doesn't use DoAllEffectOnLaunchTarget(). That function has to do with spell hit and reflecting.

Also, that's not really a proper crash report. No way to tell why it crashed, only that it crashed.

@ghost
Copy link

ghost commented Mar 5, 2012

maybe someone could file PR or directly merge into master?
great work thx for the fix ;)

@mosti
Copy link

mosti commented Mar 5, 2012

How do I apply Mrsmite's fix? any help is appreciated

@yashirotcm
Copy link

@mosti save MrSmite's patch as a .patch file, then use Git Bash and input:

patch -p1 <nameofthefile.patch

do this on the main source folder.

@oceanor
Copy link

oceanor commented Mar 6, 2012

or manually change lines, the patch is really tiny, just remove the two lines with "-" and add lines with "+" instead :)

kewarr added a commit to kewarr/TrinityCore that referenced this issue Mar 6, 2012
@Dealergoods
Copy link

Thank you MrSmite your a good guy!

@click click closed this as completed in ad569ce Apr 1, 2012
raczman pushed a commit to raczman/TrinityCore that referenced this issue Apr 20, 2014
…n world.

Original patch by kewarr and Mrsmite, additional commenting by Machiavelli removing the pet-specific checks applied.
Fixes TrinityCore#5400.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.