Commit e27caa8
fix(distributed): leaf timeout between requests + streaming space loss
Both found by live-testing 2-node native mode on real hardware with
TinyLlama. Both would have hit users on the multi-machine path.
1. Leaf timed out between requests
recv_tensor had a 300s default applied to every receive, including
the leaf's "wait for next prompt" call in broadcast_metadata. After
5 minutes of user think-time the socket fired TimeoutError and the
leaf loop crashed. Fix: broadcast_metadata and broadcast_metadata_objects
now pass timeout=None on the receive side — the wait for the next
user message is unbounded and shouldn't time out.
2. Streaming output had no spaces
_generate_stream decoded one token at a time and yielded the result.
For SentencePiece/BPE tokenizers (Llama/Mistral/Qwen), the leading
space metadata only appears when decoding multiple tokens together,
so individual decodes produced "Thereare50states" instead of
"There are 50 states". Fix: track the running token id list, decode
the full list each step, and yield only the new substring. Standard
incremental-decode pattern used by HF TextStreamer.
Both verified live: leaf survived a multi-minute pause between
requests, and TinyLlama-Chat output now renders with spaces in the
chat UI.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 6606be8 commit e27caa8
2 files changed
Lines changed: 23 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
424 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
| |||
430 | 433 | | |
431 | 434 | | |
432 | 435 | | |
433 | | - | |
| 436 | + | |
| 437 | + | |
434 | 438 | | |
435 | 439 | | |
436 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
| |||
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
264 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
265 | 272 | | |
266 | | - | |
267 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
268 | 279 | | |
269 | 280 | | |
270 | 281 | | |
| |||
0 commit comments