Skip to content

Commit e061c55

Browse files
authored
feat: clamp zero I/O concurrency (#6332)
This PR adds a small safety guard in FileSegmentSource::open(): if VortexReadAt::concurrency() returns 0, we log a warning and clamp it to 1. This avoids potential stalls or panics from calling buffer_unordered(0) while keeping normal behavior unchanged for valid concurrency values. Signed-off-by: cancaicai <2356672992@qq.com>
1 parent 86207d0 commit e061c55

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

vortex-file/src/segments/source.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use vortex_array::buffer::BufferHandle;
1717
use vortex_buffer::Alignment;
1818
use vortex_error::VortexResult;
1919
use vortex_error::vortex_err;
20+
use vortex_error::vortex_panic;
2021
use vortex_io::VortexReadAt;
2122
use vortex_io::runtime::Handle;
2223
use vortex_layout::segments::SegmentFuture;
@@ -91,6 +92,12 @@ impl FileSegmentSource {
9192
config
9293
});
9394
let concurrency = reader.concurrency();
95+
if concurrency == 0 {
96+
vortex_panic!(
97+
"VortexReadAt::concurrency returned 0 (uri={:?}); this would stall I/O",
98+
reader.uri()
99+
);
100+
}
94101

95102
let stream = IoRequestStream::new(
96103
StreamExt::boxed(recv),

0 commit comments

Comments
 (0)