sogladev / mod-vanilla-naxxramas

AzerothCore custom module that brings back vanilla Naxxramas
GNU Affero General Public License v3.0
4 stars 3 forks source link

Bug: Client crash when logout in Naxxramas #43

Closed valsan-azerty-boi closed 1 month ago

valsan-azerty-boi commented 1 month ago

Current Behaviour

When a player logout inside Naxxramas, when he logs back in, then the game client will just crash every time.

This is a known bug also in ZhengPeiRu21/mod-individual-progression.

Expected Behaviour

Do not crash client. Permit players to relog safely in game.

Steps to reproduce the problem

  1. Logout in Naxxramas
  2. Try to re login the character
  3. The client crash

Extra Notes

I'm pushing a temporary fix: 1) A modified Eluna script from Day36512 found here. 2) For ppl who do not use Eluna, a simple C++ module for azerothcore & mod-vanilla-naxxramas (same feature but without the need of Eluna)

With the fix, player need to relog a second time, character is safely teleport outside of the raid. First time login in naxx: Client crash but the players is teleported outside. Second time login: The player is already ouside on login so he can play ez pz.

(Sorry for my bad/broken english, I'm not english native)

AC rev. hash/commit

https://github.com/sogladev/mod-vanilla-naxxramas/commit/419b9547106dd333f19d59742570cd535ed92be9 (all commit globally)

Operating system

Windows

Custom changes or Modules

sogladev/mod-vanilla-naxxramas

valsan-azerty-boi commented 1 month ago

Here the pull request (temp fix): https://github.com/sogladev/mod-vanilla-naxxramas/pull/44

sogladev commented 1 month ago

Hi thanks for raising this issue

After investigating I found that logging out and back in sometimes causes a client crash. I entered as a raid group with 2 characters, lvl60, attuned, entered through Stratholme:

client crash.txt https://gist.github.com/sogladev/914e5b8bd8c683e04e3051f9b63a838e

Exception:  0xC0000005 (ACCESS_VIOLATION) at 0023:00524868

The instruction at "0x00524868" referenced memory at "0x00000018".
The memory could not be "read".
...
particles\loginfx.m2

I'm not certain on what's causing it. My guess it has to do with the spell that's cast on entering the raid. guessing, it takes longer to load as leader, causing crash as model isn't loaded yet?

More context on that spell 29296: 29296 spell triggers with 2 sec delay 29294 29294 completes quest 9378 accept, complete, reward is done manually, spell is only there for a visual frost effect only cast 29296 for the delay 2s on the visual 29294 quest 9372 used as requirement for hidden teleporter npc and teleporter gobject, to see if entered from strat (if enabled in config)

This frost visual effect is not present in any of these cases from classic footage:

Making these changes should no longer cause a crash:

diff --git a/src/Naxxramas/scripts/instance_naxxramas.cpp b/src/Naxxramas/scripts/instance_naxxramas.cpp
index f60d1be..39d2bbf 100644
--- a/src/Naxxramas/scripts/instance_naxxramas.cpp
+++ b/src/Naxxramas/scripts/instance_naxxramas.cpp
@@ -1482,7 +1482,6 @@ public:
             return;

         // Cast on player Naxxramas Entry Flag Trigger DND - Classic (spellID: 29296)
-        player->CastSpell(player, 29296, true);
         if (player->GetQuestStatus(NAXX40_ENTRANCE_FLAG) != QUEST_STATUS_REWARDED)
         {
             // Mark player as having entered
@@ -1490,6 +1489,8 @@ public:
             player->AddQuest(quest, nullptr);
             player->CompleteQuest(NAXX40_ENTRANCE_FLAG);
             player->RewardQuest(quest, 0, player, false, false);
+            // Cast on player Naxxramas Entry Flag Trigger DND - Classic (spellID: 29296)
+            player->CastSpell(player, 29296, true); // for visual effect only, possible crash if cast on login
         }
     }
 };

Should still be OK to cast this when entering for the first time from Strat as player is logged in at the time

Please update if you can still reproduce the crash with the above patch

edit: still crashes with same error edit2: cant reproduce crash anymore after restarting