Bug Report: Server crash / watchdog timeout triggered by NetworkToolItem.regenerateCablePositions
Summary
Toggling the Network Tool overlay on a large cable network causes the server main thread to hang indefinitely, ultimately triggering the ServerHangWatchdog and crashing the server.
Environment
| Field |
Value |
| Minecraft |
1.21.1 |
| NeoForge |
21.1.221 |
| SFM |
4.32.0 |
| Java |
(server default) |
Steps to Reproduce
- Build a large SFM cable network (exact size unknown, but large enough that
regenerateCablePositions takes significant time).
- Hold a Network Tool and toggle the overlay (packet:
ServerboundNetworkToolToggleOverlayPacket).
- The server main thread blocks inside
LongOpenHashSet.addAll / LongOpenHashSet.add.
- After 60 seconds, the ServerHangWatchdog fires and the server crashes.
Expected Behavior
regenerateCablePositions should either complete in bounded time or be offloaded to an async/background thread so it does not stall the main server tick.
Actual Behavior
The server hangs on a single tick and is killed by the watchdog:
java.lang.Error: ServerHangWatchdog detected that a single server tick took 60000700.00 seconds (should be max 0.05)
at it.unimi.dsi.fastutil.longs.LongOpenHashSet.add(LongOpenHashSet.java:402)
at it.unimi.dsi.fastutil.longs.AbstractLongCollection.addAll(AbstractLongCollection.java:169)
at it.unimi.dsi.fastutil.longs.LongOpenHashSet.addAll(LongOpenHashSet.java:378)
at ca.teamdman.sfm.common.item.NetworkToolItem.regenerateCablePositions(NetworkToolItem.java:188)
at ca.teamdman.sfm.common.net.ServerboundNetworkToolToggleOverlayPacket$Daddy.handle(ServerboundNetworkToolToggleOverlayPacket.java:42)
Crash Report UUID
9812f2a0-2d61-448f-be53-5ecf9a9c0979
Full Crash Log
crash-2026-04-21_10.49.48-server.txt
Suggested Fix
regenerateCablePositions appears to perform an unbounded traversal of the cable graph on the main thread. Possible mitigations:
- Run the traversal asynchronously and send the result back to the client.
- Add a depth/count limit with a warning when the limit is exceeded.
- Cache cable positions incrementally on cable placement/removal rather than recomputing on demand.
Additional Notes
- The crash is 100% reproducible by toggling the overlay on the affected network.
- No other mod appears to be involved; the stack trace originates entirely within SFM.
- Removing or breaking up the large cable network is the only current workaround.
Bug Report: Server crash / watchdog timeout triggered by
NetworkToolItem.regenerateCablePositionsSummary
Toggling the Network Tool overlay on a large cable network causes the server main thread to hang indefinitely, ultimately triggering the ServerHangWatchdog and crashing the server.
Environment
Steps to Reproduce
regenerateCablePositionstakes significant time).ServerboundNetworkToolToggleOverlayPacket).LongOpenHashSet.addAll/LongOpenHashSet.add.Expected Behavior
regenerateCablePositionsshould either complete in bounded time or be offloaded to an async/background thread so it does not stall the main server tick.Actual Behavior
The server hangs on a single tick and is killed by the watchdog:
Crash Report UUID
9812f2a0-2d61-448f-be53-5ecf9a9c0979Full Crash Log
crash-2026-04-21_10.49.48-server.txt
Suggested Fix
regenerateCablePositionsappears to perform an unbounded traversal of the cable graph on the main thread. Possible mitigations:Additional Notes