TrinityCore / WowPacketParser

World of Warcraft Packet Parser
GNU General Public License v3.0
431 stars 358 forks source link

SMSG_UPDATE_OBJECT errors caused by using multiple threads #590

Open mdX7 opened 3 years ago

mdX7 commented 3 years ago

During my massparses i noticed thats SMSG_UPDATE_OBJECT randomy causes errors when using more threads than one. The error is not guaranteed to occur, it kinda only happens 3 times in 10 sniff parses.

Used config: https://gist.github.com/mdX7/63df65b085f011a0a087d08b0b63713e This happened on Linux (via. Docker) and on Windows aswell.

It appears to be related to new updatefield system (introduced in 8.1.0).

Release Stacktrace (on Linux):

System.ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at WowPacketParserModule.V8_0_1_27101.UpdateFields.V8_2_0_30898.UpdateFieldHandler.ReadUpdateUnitData(Packet packet, IUnitData existingData, Object[] indexes) in /app/src/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs:line 918
   at WowPacketParserModule.V8_0_1_27101.Parsers.UpdateHandler.HandleUpdateObject(Packet packet) in /app/src/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateHandler.cs:line 71
   at WowPacketParser.Parsing.Handler.Parse(Packet packet, Boolean isMultiple) in /app/src/WowPacketParser/Parsing/Handler.cs:line 149

Debug Stacktrace (parsed by @matanshukry on Windows)

System.ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
   at WowPacketParser.Misc.DynamicUpdateField`1.set_Item(Int32 index, T value) in D:\dev\Games\tc\WowPacketParser\WowPacketParser\Misc\DynamicUpdateField.cs:line 18
   at WowPacketParserModule.V8_0_1_27101.UpdateFields.V8_2_0_30898.UpdateFieldHandler.ReadUpdateUnitData(Packet packet, IUnitData existingData, Object[] indexes) in D:\dev\Games\tc\WowPacketParser\WowPacketParserModule.V8_0_1_27101\Parsers\UpdateFieldsHandler820.cs:line 986
   at WowPacketParserModule.V8_0_1_27101.Parsers.UpdateHandler.HandleUpdateObject(Packet packet) in D:\dev\Games\tc\WowPacketParser\WowPacketParserModule.V8_0_1_27101\Parsers\UpdateHandler.cs:line 71
   at WowPacketParser.Parsing.Handler.Parse(Packet packet, Boolean isMultiple) in D:\dev\Games\tc\WowPacketParser\WowPacketParser\Parsing\Handler.cs:line 149

These stacktraces actually show a different line, but both are using the same sniff with Threads set to 0. When Threads is limited to 1 everything will parse successfully, even with ~1000 sniffs.

Shauren commented 3 years ago

This is definitely also broken for old updatefields too - it also uses a List to store dynamic fields