Quick answer: GameMaker game freezing when Async Networking Event sends another packet? Recursive sends inside the event handler block - queue the send for the next step instead.
Receiving an ack triggers another send. Game hangs indefinitely; profiler shows infinite event recursion.
Queue the send
var outbox = ds_list_create();
ds_list_add(outbox, payload);Process the outbox in the Step event, not inside the Async Networking handler.
Or use a coroutine pattern
GameMaker 2024 has time sources. Schedule the send for the next frame via time_source_start.
Audit reentrancy
Any send inside an Async Network handler is suspicious. Audit before shipping; the deadlock surfaces under stress, not in dev testing.
“Async handlers are not reentrant. Queue and process; don't recurse.”
For chat-heavy networking, separate inbound and outbound queues entirely. Each runs on its own step pass; no risk of recursion.