Skip to content

fix: Duplicated add combatant lines from concurrent state checks#534

Merged
valarnin merged 1 commit into
OverlayPlugin:mainfrom
MnFeN:Duplicated105
May 7, 2026
Merged

fix: Duplicated add combatant lines from concurrent state checks#534
valarnin merged 1 commit into
OverlayPlugin:mainfrom
MnFeN:Duplicated105

Conversation

@MnFeN

@MnFeN MnFeN commented May 4, 2026

Copy link
Copy Markdown

In extremely rare cases, LineCombatant can emit duplicate Add lines for the same combatant within a short time window. In my logs, this occurred in less than 0.1% of single-mechanic captures (e.g. the Loop towers in TOP P1), but it can still break triggers that wait for data from the first n EventObject entries before continuing.

Example log:

[00:34:50.229] 261 105:Add:4000A2AE:BNpcID:1EB83D:...:PosX:112.0000:PosY:97.0000:...
[00:34:50.229] 261 105:Add:4000A2B0:BNpcID:1EB83D:...:PosX:88.0000:PosY:103.0000:...
[00:34:50.332] 261 105:Add:4000A2AE:BNpcID:1EB83D:...:PosX:112.0000:PosY:97.0000:...
[00:34:50.332] 261 105:Add:4000A2B0:BNpcID:1EB83D:...:PosX:88.0000:PosY:103.0000:...

This appears to be caused by a race condition where multiple checks can observe the same combatant as missing before one of them adds it to the state map. This change makes the add path use TryAdd.

Since the issue is extremely rare, I cannot confirm that it is actually fixed, but it addresses the race condition I was able to identify.

@ShadyWhite ShadyWhite requested a review from valarnin May 7, 2026 04:06
@valarnin valarnin merged commit f9b59f5 into OverlayPlugin:main May 7, 2026
2 checks passed
@MnFeN MnFeN deleted the Duplicated105 branch May 24, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants