Skip to content

Commit 5935cce

Browse files
authored
fix(sql): memory leak when querying a table which is being ALTERed concurrently (#6055)
1 parent f34f936 commit 5935cce

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

core/src/main/java/io/questdb/griffin/SqlCodeGenerator.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,11 +2444,19 @@ private RecordCursorFactory generateFilter0(
24442444
executionContext.getSharedQueryWorkerCount()
24452445
);
24462446
} catch (SqlException | LimitOverflowException ex) {
2447+
// for these errors we are intentionally **not** rethrowing the exception
2448+
// if a JIT filter cannot be used, we will simply use a Java filter
24472449
Misc.free(compiledFilter);
24482450
LOG.debug()
24492451
.$("JIT cannot be applied to (sub)query [tableName=").$safe(model.getName())
24502452
.$(", ex=").$safe(ex.getFlyweightMessage())
24512453
.$(", fd=").$(executionContext.getRequestFd()).$(']').$();
2454+
} catch (Throwable t) {
2455+
// other errors are fatal -> rethrow them
2456+
Misc.free(compiledFilter);
2457+
Misc.free(filter);
2458+
Misc.free(factory);
2459+
throw t;
24522460
} finally {
24532461
jitIRSerializer.clear();
24542462
jitIRMem.truncate();

0 commit comments

Comments
 (0)