Skip to content

Commit 03fd994

Browse files
committed
Adjusted comm‑simulation sending so the payload file is written before the report is emitted.
This prevents the server from trying to read a missing or stale file and dropping the Socket.IO connection. The “transport error” is Socket.IO’s disconnect reason when the server closes the underlying connection; with file‑based simulation and high concurrency, the server can receive the report before the client finishes writing the payload file, triggering an exception and a disconnect.
1 parent 0141ae5 commit 03fd994

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plato/clients/strategies/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,12 @@ async def send_report_and_payload(
218218
self, context: ClientContext, report: Any, payload: Any
219219
) -> None:
220220
"""Send both report metadata and payload to the server."""
221+
if getattr(context, "comm_simulation", False):
222+
# The server reads the simulated payload file as soon as the report arrives.
223+
# Write the payload first to avoid races under high concurrency.
224+
await self.send_payload(context, payload)
225+
await self.send_report(context, report)
226+
return
227+
221228
await self.send_report(context, report)
222229
await self.send_payload(context, payload)

0 commit comments

Comments
 (0)