Mooncake icon indicating copy to clipboard operation
Mooncake copied to clipboard

[Bug]: Receiver side race condition

Open ShangmingCai opened this issue 1 year ago • 7 comments

Bug Report

context: https://github.com/sgl-project/sglang/pull/13231

cc: @alogfans

Before submitting...

  • [x] Ensure you searched for relevant issues and read the [documentation]

ShangmingCai avatar Nov 18 '25 02:11 ShangmingCai

@flying-x Thank you so much for the digging. I think we can discuss and arrange a fix here.

ShangmingCai avatar Nov 18 '25 02:11 ShangmingCai

@flying-x So the fix scope should be inside tcp_transport, especially the ASIO callback logic. Try to check that if there are multiple slices for a single request.

alogfans avatar Nov 18 '25 10:11 alogfans

Thank you @ShangmingCai and @alogfans.

I am thinking that the sender side can queue a readBody call after sending all slices and when the callback of the readBody is done, it then calls markSuccess(). On the receiving side, once all readBody calls are done (including cudaMemcpy calls), it will send an ACK msg (1 byte, with writeBody and then finish the request) so that readBody call from the sender side will be unblocked.

The sender side needs to have a timeout on the readBody, but other than that, there should be no new error handling.

Does the above sound OK?

flying-x avatar Nov 18 '25 19:11 flying-x

This will definitely increase the TTFT, but I assume TCP fallback doesn't require strict SLO for TTFT.

As long as we can keep most changes in the mooncake part, this method seems reasonable to me.

ShangmingCai avatar Nov 19 '25 06:11 ShangmingCai

In fact, I previously encountered a similar issue when testing with TCP. After the TE reports that the transfer has completed successfully, if you immediately check the data on the receiving side, there is a chance that the data has not been fully written yet.

ykwd avatar Nov 21 '25 02:11 ykwd

This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.

github-actions[bot] avatar Jun 19 '26 04:06 github-actions[bot]

Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.

github-actions[bot] avatar Jun 26 '26 04:06 github-actions[bot]