go-ora icon indicating copy to clipboard operation
go-ora copied to clipboard

Context timeout not respected in ExecContext

Open firdavstoshev opened this issue 2 months ago • 0 comments

When using context.WithTimeout with Conn, PrepareContext, and ExecContext, the query execution continues far beyond the specified timeout duration.

Example Code

ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()

conn, err := c.cft.Conn(ctx)
if err != nil {
    return err
}
defer conn.Close()

stmt, err := conn.PrepareContext(ctx, queryStr)
if err != nil {
    return err
}
defer stmt.Close()

_, err = stmt.ExecContext(ctx, args...)
if err != nil {
    return err
}

Expected behavior The query execution should be canceled once the context timeout (15 seconds) is reached, and ctx.Err() should be returned.

Actual behavior The function continues executing even after the timeout expires — in some cases up to 110 seconds before returning.

Additional information

  • go-ora version: v2.8.24
  • Go version: go1.22.5
  • Database: Oracle 11
  • OS: Linux

firdavstoshev avatar Oct 16 '25 10:10 firdavstoshev