[BUG] JACCL segfaults in tbt_post_recv when a Thunderbolt cable is unplugged mid-collective
Describe the bug
Unplugging the Thunderbolt cable during a JACCL collective crashes both ranks with SIGSEGV inside libthunderboltrdma.dylib, reached from jaccl::Connection::post_recv. Both ends die even though only one end is physically unplugged. No exception, no log line, process simply goes away.
This is distinct from #3910, which is a silent hang on peer loss. On this hardware, process death produces that hang; link loss produces this crash.
EXC_BAD_ACCESS SIGSEGV KERN_INVALID_ADDRESS at 0x0000000104ac4008
libthunderboltrdma.dylib tbt_post_recv
libthunderboltrdma.dylib tbt_post_recv
jaccl::Connection::post_recv(jaccl::SharedBuffer const&, unsigned long long)
void jaccl::MeshImpl::all_reduce<float, jaccl::SumOp<float>>(float const*, float*, long long, jaccl::SumOp<float>)
main
The faulting address is a few pages into a mapped region, consistent with a registered buffer whose backing went away with the device.
To Reproduce
Two Macs direct-attached over Thunderbolt, rdma_ctl enable done from Recovery OS on both, and an IPv4 address on each TB port (otherwise you hit #3467 first).
Two ranks running a collective in a loop:
auto g = jaccl::init();
float in[256], out[256];
for (int i = 0; i < 256; i++) in[i] = 1.0f;
for (;;) g->all_sum(in, out, sizeof(in), jaccl::Float32);
Unplug the cable at either end mid-run. Both ranks die immediately. 4/4 across two independent pulls, on unmodified MLX at 596dc79f4.
The last completed iteration takes ~200 ms versus ~3 us steady state, so something is noticed, but isn't survivable.
Expected behavior
Losing a link should surface as an error the caller can catch, the way a lost peer should. A SIGSEGV inside the driver gives the application nothing to handle and leaves no diagnostic.
I can't tell from outside whether the defect is that post_recv is called against a device that has gone away, or something in libthunderboltrdma itself. Happy to dig further if it's useful.
Desktop
- 2x Mac mini M4 Pro (
Mac16,11), macOS 26.5.1 - Direct Thunderbolt 5, 80 Gb/s, RDMA enabled from Recovery OS
- MLX at
596dc79f4, jaccl built frommlx/distributed/jaccl/lib
Same tbt_post_recv / trailing-008 family, but not an unplug: mesh still PORT_ACTIVE, no model, unique 256 MiB all_sum died in RingImpl::all_reduce<unsigned char> after seven good cycles. Filed separately as #4319 so this issue stays the unplug repro.
Two more occurrences of this exact crash, from production rather than a deliberate unplug, on a different hardware class.
Setup: 5 × Mac Studio M3 Ultra (1 × 512 GB + 4 × 256 GB), Thunderbolt 5 full mesh (10 direct links, all negotiated at 80 Gb/s), RDMA enabled, macOS 26.6.1 (25G76), mlx 0.32.2 with the liveness patch from #4530 applied to libjaccl. Workload: GLM-5.3 744B 8-bit, pipeline-parallel over JACCL, serving continuously.
Trigger: nobody touched a cable. A Thunderbolt link between two nodes dropped on its own mid-transfer (the port at the other end reports PORT_DOWN afterwards). It happened twice in two days on two different links, 2026-09-18 and 2026-09-20. Same signature both times, same trailing-008 fault address family as above:
EXC_BAD_ACCESS SIGSEGV KERN_INVALID_ADDRESS at 0x0000000109ae4008 (18th)
EXC_BAD_ACCESS SIGSEGV KERN_INVALID_ADDRESS at 0x0000000105ce0008 (20th)
libthunderboltrdma.dylib tbt_post_recv + 512
libthunderboltrdma.dylib tbt_post_recv + 492
libjaccl.dylib jaccl::Connection::post_recv(jaccl::SharedBuffer const&, unsigned long long) + 124
libjaccl.dylib jaccl::MeshImpl::all_gather(char const*, char*, long long) + 460
libmlx.dylib mlx::core::scheduler::StreamThread::thread_fn() + 456
Two details that may help narrow it down:
- Only the rank at one end of the dropped link died; the rank at the other end survived (with #4530 it raised
[jaccl] peer is gonewithin a second, on stock JACCL it would have spun forever as in #3910). So on a mesh the fault is not symmetric the way it is in the 2-node unplug repro. - The crashed node keeps ~140 GB wired (its registered memory) after the process is gone, and the affected port stays
PORT_DOWN, until the node is rebooted. Nothing short of a reboot releases it. So atbt_post_recvagainst a device that has just gone away leaves the MR/PD state behind as well as killing the process.
Before the first drop the same 5-rank group had run 39 h without interruption (1.25 M tokens generated, zero JACCL events), so this is not a steady-state instability, it is strictly the link-loss path.
One question for anyone who can test it: libthunderboltrdma.dylib has been reworked in the macOS 27 builds (per the public dyld-cache diffs: assertions added to tbt_post_recv / tbt_post_send / tbt_reg_mr, then tbt_post_recv rewritten and tbt_poll_qp_recv extended). Has anyone re-run the unplug repro on macOS 27? We are still on 26.6.1 in production and would rather not upgrade five nodes blind.
Both .ips files available on request (they are from Python processes, ~100 KB each).
Closed by https://github.com/ml-explore/mlx/pull/4767