Commit fb47849
Fix stream consumer failure hang in Lance streaming writer
When the Rust streaming task exits early (disk error, write failure),
push() would block indefinitely: the queue stays full, nothing notifies
not_full_cv_, and the C++ producer hangs forever.
Fix:
- Add lance_writer_stream_is_alive() Rust FFI: polls JoinHandle::is_finished()
to detect whether the background task is still consuming the stream.
- Add StreamState::set_health_check(fn): stores a callback invoked when
a push() timeout fires without a real queue-drain notification.
- Rewrite the stall wait from bare wait() to a wait_for(500ms) loop:
on each timeout, call the health check; if the task is gone, call
set_error() which unblocks both not_full_cv_ and not_empty_cv_.
- Wire up in initialize_lance_dataset(): register a lambda that calls
lance_writer_stream_is_alive(rust_writer_) after stream start.
The 500 ms poll interval means producers unblock within half a second of
a Rust task crash, rather than hanging until process kill. Normal
operation (no task failure) adds zero overhead: the health check is only
reached on a wait_for timeout, which only fires when the queue stays full
for 500 ms without a pop — i.e., already a stall event.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 9d4f425 commit fb47849
3 files changed
Lines changed: 55 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
33 | 51 | | |
34 | 52 | | |
35 | 53 | | |
| |||
119 | 137 | | |
120 | 138 | | |
121 | 139 | | |
| 140 | + | |
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
| |||
268 | 287 | | |
269 | 288 | | |
270 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
271 | 297 | | |
272 | 298 | | |
273 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
374 | 389 | | |
375 | 390 | | |
376 | 391 | | |
| |||
0 commit comments