Add network diagnostics logging and migrate to tinylog#10004
Merged
tool4ever merged 2 commits intoCard-Forge:masterfrom Mar 7, 2026
Merged
Add network diagnostics logging and migrate to tinylog#10004tool4ever merged 2 commits intoCard-Forge:masterfrom
tool4ever merged 2 commits intoCard-Forge:masterfrom
Conversation
- Migrate all System.out/err in network package to Logger (tinylog) so every log line gets timestamps - Add processing duration and EDT queue delay timing (>50ms threshold) - Add beforeCall() IO-thread timing to detect tracker bottlenecks - Add server-side send() duration to detect write stalls - Log game event types in batches for correlation - Log serialized message size and decode duration (>10KB or >50ms) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tool4ever
reviewed
Mar 7, 2026
forge-gui/src/main/java/forge/gamemodes/net/server/NetGuiGame.java
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tool4ever
approved these changes
Mar 7, 2026
MostCromulent
added a commit
to MostCromulent/forge
that referenced
this pull request
Mar 8, 2026
Resolve conflicts from network diagnostics logging PR (Card-Forge#10004) and cleanup PR (Card-Forge#10002). All network logging routes through NetworkDebugLogger (tinylog NETWORK tag) for separate log files. Port new diagnostic instrumentation (decode timing, beforeCall timing, EDT queue delay, protocol processing time, send() blocking, large message detection) via NetworkDebugLogger. Take master's updateLobbyState() call in RegisterClientHandler.channelActive(). 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.
Summary
Existing logging uses
System.out.println(no timestamps) and provided no performance metrics, making it impossible to identify bottlenecks from log files alone.Migrates all network
System.out/System.errlogging to tinylog (Logger) and adds targeted performance diagnostics with thresholds to avoid log noise during normal play.Changes
1. tinylog Migration (all network classes)
Every
System.out.printlnandSystem.err.printlncall in the network package is replaced with the appropriateLogger.info,Logger.warn, orLogger.errorcall. This ensures every log line gets a timestamp, log level, and thread name — critical for correlating events between server and client logs.Files:
GameProtocolHandler,FGameClient,FServerManager,GameClientHandler,ProtocolMethod,TrackableTypes2. Protocol Processing Duration (
GameProtocolHandler)Measures wall-clock time for
method.invoke()execution and EDT queue delay (time between message arrival on the IO thread and actual processing on the EDT). Logged only when either exceeds 50 ms — a threshold chosen as the point where per-message delay becomes perceptible. Normal protocol calls complete in single-digit milliseconds, so this fires only on genuine bottlenecks.3. IO-Thread
beforeCall()Timing (GameProtocolHandler)Measures time spent in
beforeCall(), which runs on Netty's single IO thread and includesupdateTrackers()andreplicateProps(). Logged only above 50 ms. This is the most likely cause of the reported multi-second delays —beforeCall()blocks ALL subsequent network messages, so if it's slow, every message in the pipeline backs up. Normal execution is sub-millisecond.4.
send()Duration (RemoteClient)Measures how long
writeAndFlush().sync()blocks the calling thread. Logged only above 50 ms. Detects TCP back-pressure or slow client acknowledgment causing the server game thread to stall. Under normal network conditions this completes near-instantly.5. Serialization Size Logging (
CompatibleObjectEncoder/CompatibleObjectDecoder)Logs compressed frame size and decode duration for messages exceeding 20 KB compressed. Normal
setGameViewpackets are ~8–15 KB compressed in 2-player games, so the 20 KB threshold fires selectively — primarily on 4-player games (~15–25 KB compressed) and anomalously large 2-player states. Decode duration is also logged above 50 ms to catch deserialization bottlenecks.6. Event Type Identification (
NetGuiGame)Logs the class names of game events in each batch sent to the client. Correlates server-side event batches with client-side processing delays to identify which game actions trigger the heaviest network traffic.
🤖 Generated with Claude Code