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

Adjust cross-thread error message #4181

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Source/ACE.Server/Entity/Landblock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,19 @@ private bool AddWorldObjectInternal(WorldObject wo)
{
if (CurrentLandblockGroup != null && CurrentLandblockGroup != LandblockManager.CurrentMultiThreadedTickingLandblockGroup.Value)
{
// Prevent possible multi-threaded crash
// The following scenario can happen rarely in ACE, all in the same call stack with no ActionQueue usage:
// Moster successfully lands an attack on a player that procs a cloak spell
// The code goes through and does the LaunchSpellProjectiles() which adds the spell projectiles to (presumably) the players landblock
// For some unknown reason, the LandblockGroup/Thread where the monster exists seems to be a different LandblockGroup/Thread where the spells are added to.
// Maybe there's a player death race condition? Maybe it's a teleport race condition? I dunno.
// Because this happens so rarely, and, it only seems to affect cloak projectiles, and, cloak projectiles are pretty benign, we simply don't add the object, and only log it as a warning.
if (wo.WeenieType == WeenieType.ProjectileSpell)
{
log.Warn($"Landblock 0x{Id} entered AddWorldObjectInternal in a cross-thread operation for a ProjectileSpell. This is normally not an issue unless it's happening more than once an hour.");
return false;
}

log.Error($"Landblock 0x{Id} entered AddWorldObjectInternal in a cross-thread operation.");
log.Error($"Landblock 0x{Id} CurrentLandblockGroup: {CurrentLandblockGroup}");
log.Error($"LandblockManager.CurrentMultiThreadedTickingLandblockGroup.Value: {LandblockManager.CurrentMultiThreadedTickingLandblockGroup.Value}");
Expand All @@ -842,10 +855,6 @@ private bool AddWorldObjectInternal(WorldObject wo)

log.Error("PLEASE REPORT THIS TO THE ACE DEV TEAM !!!");

// Prevent possible multi-threaded crash
if (wo.WeenieType == WeenieType.ProjectileSpell)
return false;

// This may still crash...
}
}
Expand Down