Skip to content

Commit 12ad825

Browse files
committed
fix: fromOperator() drain loop leaks operator on error — add try/finally
Same pattern as the drainPipeline() fix in b6836a2: if op.next() throws, op.close() was never called, leaking any spill files or open resources.
1 parent b6836a2 commit 12ad825

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,14 @@ export class DataFrame<T extends Row = Row> {
825825
const drainExecutor: QueryExecutor = {
826826
async execute(_query: QueryDescriptor): Promise<QueryResult> {
827827
const rows: Row[] = [];
828-
let batch: RowBatch | null;
829-
while ((batch = await op.next()) !== null) {
830-
for (const row of batch) rows.push(row);
828+
try {
829+
let batch: RowBatch | null;
830+
while ((batch = await op.next()) !== null) {
831+
for (const row of batch) rows.push(row);
832+
}
833+
} finally {
834+
await op.close();
831835
}
832-
await op.close();
833836
return {
834837
rows,
835838
rowCount: rows.length,

0 commit comments

Comments
 (0)