Complete PJRT copy futures via event callbacks instead of awaiter threads - #681
Open
copybara-service[bot] wants to merge 1 commit into
Open
Complete PJRT copy futures via event callbacks instead of awaiter threads#681copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…eads PjRtCopyFuture::OnReady parked a detached thread in PJRT_Event_Await per in-flight copy; on the transfer receive path that is one short-lived thread per layer per transfer, and sustained decode-side load crashed schedulers with a segfault in the detach on the push-handler path. Register a PJRT_Event_OnReady callback per event instead, joined by a countdown that preserves the first error; completion callbacks now run on PJRT completion threads rather than a dedicated awaiter. Core dump before the CL: https://github.com/sgl-project/sglang-torchtpu/actions/runs/31962643994 !!!!!!! Segfault encountered !!!!!!! File "<unknown>", line 0, in raise File "<unknown>", line 0, in pthread_detach File "<unknown>", line 0, in std::thread::detach() File "<unknown>", line 0, in tpu_raiden::KVCacheManagerWithTransfer::OnLayerReceived(unsigned long, unsigned long) File "<unknown>", line 0, in tpu_raiden::transport::BlockTransport::HandleIncomingPush(int, tpu_raiden::transport::lib::ChunkHeader const&) File "<unknown>", line 0, in tpu_raiden::transport::BlockTransport::HandleCustomRequest(int, tpu_raiden::transport::lib::ChunkHeader const&) File "<unknown>", line 0, in tpu_raiden::transport::lib::RawBufferTransport::ProcessPeerRequest(int) File "<unknown>", line 0, in tpu_raiden::transport::lib::RawBufferTransport::ConnectionWorker(int) File "<unknown>", line 0, in 0xffffffffffffffff PiperOrigin-RevId: 965614436
copybara-service
Bot
force-pushed
the
test_965614436
branch
from
August 16, 2026 23:28
8fffeaf to
041e5a2
Compare
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.
Complete PJRT copy futures via event callbacks instead of awaiter threads
PjRtCopyFuture::OnReady parked a detached thread in PJRT_Event_Await per
in-flight copy; on the transfer receive path that is one short-lived
thread per layer per transfer, and sustained decode-side load crashed
schedulers with a segfault in the detach on the push-handler path.
Register a PJRT_Event_OnReady callback per event instead, joined by a
countdown that preserves the first error; completion callbacks now run
on PJRT completion threads rather than a dedicated awaiter.
Core dump before the CL:
https://github.com/sgl-project/sglang-torchtpu/actions/runs/31962643994
!!!!!!! Segfault encountered !!!!!!!
File "", line 0, in raise
File "", line 0, in pthread_detach
File "", line 0, in std::thread::detach()
File "", line 0, in tpu_raiden::KVCacheManagerWithTransfer::OnLayerReceived(unsigned long, unsigned long)
File "", line 0, in tpu_raiden::transport::BlockTransport::HandleIncomingPush(int, tpu_raiden::transport::lib::ChunkHeader const&)
File "", line 0, in tpu_raiden::transport::BlockTransport::HandleCustomRequest(int, tpu_raiden::transport::lib::ChunkHeader const&)
File "", line 0, in tpu_raiden::transport::lib::RawBufferTransport::ProcessPeerRequest(int)
File "", line 0, in tpu_raiden::transport::lib::RawBufferTransport::ConnectionWorker(int)
File "", line 0, in 0xffffffffffffffff