MountainDrew8 / CalamityMod

Has something in it that does stuff
119 stars 33 forks source link

System.IndexOutOfRangeException #30

Open Wadges opened 2 years ago

Wadges commented 2 years ago

Hello, we've been experiencing server crashes that seems related to an IndexOutOfRangeException bug. The server crashes with the following message : "Game ran out of memory. You'll have to find which mod is consuming lots of memory, and contact the devs or remove it."

We're playing with the Thorium / Calamity and Terraria overhaul mods as well as the 64bits tModLoader.

server.txt logs :

[14:49:59] [1/WARN] [tML]: Silently Caught Exception: 
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at CalamityMod.CalamityNetcode.HandlePacket(Mod mod, BinaryReader reader, Int32 whoAmI) in CalamityMod\CalamityNetcode.cs:line 34
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[14:50:51] [1/WARN] [tML]: Silently Caught Exception: 
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at CalamityMod.Cooldowns.CooldownInstance..ctor(BinaryReader reader) in CalamityMod\Cooldowns\CooldownInstance.cs:line 57
   at CalamityMod.CalPlayer.CalamityPlayer.HandleCooldownDictionary(BinaryReader reader) in CalamityMod\CalPlayer\CalamityPlayerNetcode.cs:line 329
   at CalamityMod.CalamityNetcode.HandlePacket(Mod mod, BinaryReader reader, Int32 whoAmI) in CalamityMod\CalamityNetcode.cs:line 84
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[14:54:42] [1/WARN] [tML]: Silently Caught Exception: 
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at CalamityMod.CalPlayer.CalamityPlayer.HandleCooldownRemoval(BinaryReader reader) in CalamityMod\CalPlayer\CalamityPlayerNetcode.cs:line 310
   at CalamityMod.CalamityNetcode.HandlePacket(Mod mod, BinaryReader reader, Int32 whoAmI) in CalamityMod\CalamityNetcode.cs:line 81
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[14:54:52] [1/WARN] [tML]: Silently Caught Exception: 
System.IO.IOException: Read underflow 9 of 5 bytes caused by CalamityMod in HandlePacket
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[14:58:26] [1/WARN] [tML]: Silently Caught Exception: 
System.OutOfMemoryException: Array dimensions exceeded supported range.
   at System.Collections.Generic.Dictionary`2.Initialize(Int32 capacity)
   at System.Collections.Generic.Dictionary`2..ctor(Int32 capacity, IEqualityComparer`1 comparer)
   at CalamityMod.CalPlayer.CalamityPlayer.HandleCooldownDictionary(BinaryReader reader) in CalamityMod\CalPlayer\CalamityPlayerNetcode.cs:line 326
   at CalamityMod.CalamityNetcode.HandlePacket(Mod mod, BinaryReader reader, Int32 whoAmI) in CalamityMod\CalamityNetcode.cs:line 84
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[14:58:26] [1/FATAL] [tML]: Game ran out of memory. You'll have to find which mod is consuming lots of memory, and contact the devs or remove it.
[14:58:36] [Server Hang Watchdog/ERROR] [tML]: Server hung for more than 10 seconds:
   at System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
   at System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
   at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
   at Terraria.ModLoader.UI.Interface.MessageBoxShow(String text, String caption)
   at Terraria.ModLoader.Logging.FirstChanceExceptionHandler(Object sender, FirstChanceExceptionEventArgs args)
   at System.Collections.Generic.Dictionary`2.Initialize(Int32 capacity)
   at System.Collections.Generic.Dictionary`2..ctor(Int32 capacity, IEqualityComparer`1 comparer)
   at CalamityMod.CalPlayer.CalamityPlayer.HandleCooldownDictionary(BinaryReader reader) in CalamityMod\CalPlayer\CalamityPlayerNetcode.cs:line 326
   at CalamityMod.CalamityNetcode.HandlePacket(Mod mod, BinaryReader reader, Int32 whoAmI) in CalamityMod\CalamityNetcode.cs:line 84
   at DMD<Terraria.ModLoader.ModNet::HandleModPacket>(BinaryReader , Int32 , Int32 )
   at TerrariaOverhaul.Core.Systems.Networking.Multiplayer.OverhaulMessage.ModNet_HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length)
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType)
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex)
   at Terraria.Netplay.<>c.<ServerLoop>b__44_2()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)
   at Terraria.Netplay.OnUpdate()
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Terraria.Main.DedServ()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)
dude4123 commented 2 years ago

in another post I saw that it was a Magic Storage problem I have that mod in multiplayer and all the ram is consumed but I still haven't verified that this is the error another solution would be to download an old version I think that 1.5.0.4 does not give those problems

dr01d3r commented 2 years ago

@dude4123 I'm getting the same issue, as many other people are, and I'm not using Magic Storage. Based on discussions in the tModLoader discord, it's the new Calamity patch.

I can't be 100% since I wasn't paying close attention early on, but fighting bosses is when it seemed to always happen, and usually when a boss was nearly dead. A couple things that "helped" were to disable all boss options in the config, like health bars, etc., as well as keeping revengeance mode off. This wasn't fool-proof, as we crashed during a Wall of Flesh fight, but we've been able to clear after a few tries.

dude4123 commented 2 years ago

I wish I didn't try an old version but in some tests with friends we noticed that it is less frequent without imkSushi's Mod and the magic storage did not give problems

Wadges commented 2 years ago

I do not use the Magic storage mod so that's probably unrelated. Theses crashes happens when fighting bosses (mostly at the end of the fights). I'll try to use an older version of the mod.

Wadges commented 2 years ago

Played one session on the 1.5.0.4 version and we haven't experienced any crashes. It's an issue with the latest build.