Description
If the context is already cancelled before RunBatchSession is called, the function still blocks on <-initData.Loaded instead of returning immediately with the context error.
Severity
MEDIUM - Poor context handling
Test Reference
Test: TestRunBatchSession_ContextCancellation in pkg/query/queryexecute/execute_test.go:112 (skipped)
Suggested Fix
Check context before blocking:
if err := ctx.Err(); err != nil {
return 0, err
}
select {
case <-initData.Loaded:
case <-ctx.Done():
return 0, ctx.Err()
}
Related Code
pkg/query/queryexecute/execute.go:58