Fix network game race condition from event batching#9911
Merged
tool4ever merged 1 commit intoCard-Forge:masterfrom Feb 27, 2026
Merged
Fix network game race condition from event batching#9911tool4ever merged 1 commit intoCard-Forge:masterfrom
tool4ever merged 1 commit intoCard-Forge:masterfrom
Conversation
Flush game events on the game thread instead of EDT so the game thread blocks during Netty serialization, preventing concurrent modification of FCollection/EnumMap objects that caused ArrayIndexOutOfBoundsException. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MostCromulent
added a commit
to MostCromulent/forge
that referenced
this pull request
Feb 27, 2026
- Make convertToAI public so the test calls the production method instead of reimplementing its logic inline (fixes clear-then-swap ordering bug — production correctly does swap-then-clear) - Move UPnP preference into FModel.initialize callback alongside other test preferences, removing manual save/restore - Remove dead code: findHumanController helper, 7 unused imports Test passes with 0 send errors when Card-Forge#9911 fix is applied. Without Card-Forge#9911, fails with 47 send errors (expected — known race). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tool4ever
approved these changes
Feb 27, 2026
MostCromulent
added a commit
to MostCromulent/forge
that referenced
this pull request
Feb 28, 2026
Incorporates upstream event batching race condition fix (Card-Forge#9911), CI network integration test (Card-Forge#9935), and adopt real EDT threading for headless test infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@tool4ever
The batching commit (742c7ba) introduced a race condition for network games. Events were queued and flushed on the Swing EDT, leaving the game thread free to modify
FCollection/EnumMapobjects while Netty serialized them on the I/O thread -causingArrayIndexOutOfBoundsExceptioninEnumMap.writeObject().This fix flushes events on the game thread instead of EDT, so the game thread blocks during serialization. Batching is preserved via time (50ms) and size (50 event) thresholds. A pre-send flush in
NetGuiGameguarantees events reach the client before any interactive prompt.3 files changed, no engine modifications.
Tested in local network play (host + remote client) - previously had repeated
ArrayIndexOutOfBoundsExceptionduring serialization, now no errors following fix.🤖 Generated with Claude Code