TrinityCore / TrinityCore/WowPacketParser

SMSG_UPDATE_OBJECT errors caused by using multiple threads

Open
#590 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
522
Forks
387
Avg merge
3d 6h
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with WowPacketParserModule/V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs at the reported lines, then inspect WowPacketParser/Misc/DynamicUpdateField.cs and UpdateHandler.cs. Reproduce the parse with Threads above 1 using the linked configuration and compare it with Threads set to 1. Done means the same sniffs parse without the reported index errors when multiple threads are enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.