Commit a028026
fix(embedding): send Connection: close to avoid stale keep-alive
Root cause of the WriteFailed-at-batch-32 issue: std.http.Client
pools keep-alive sockets. When the embedding server closes an idle
socket (uvicorn does this after a short window), the next POST
lands on a half-closed socket and fails mid-sendBodyComplete with
error.WriteFailed.
Retry didn't help because all retries reused the same pooled socket
and got the same failure. Live reproduction on validate_gui
confirmed the exact same 186-byte payload failed 3x in a row via
codescan, but succeeded via curl with a fresh connection.
Sending Connection: close forces std.http to open a fresh TCP
connection for each embed request. Extra per-request cost is a
one-time TCP handshake (~ms on localhost), negligible for indexing.
Verified end-to-end: validate_gui indexes 83/83 files with zero
errors post-fix (previously stalled at 32/103).1 parent e0e3b9d commit a028026
1 file changed
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | | - | |
47 | | - | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| |||
342 | 346 | | |
343 | 347 | | |
344 | 348 | | |
| 349 | + | |
345 | 350 | | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
350 | | - | |
| 355 | + | |
| 356 | + | |
351 | 357 | | |
352 | 358 | | |
353 | 359 | | |
| |||
514 | 520 | | |
515 | 521 | | |
516 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
517 | 535 | | |
518 | 536 | | |
519 | 537 | | |
| |||
0 commit comments