Skip to content

RunBatchSession doesn't check context before blocking #4794

@e-gineer

Description

@e-gineer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions