Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Timeouts since 2.8.8 #513

Closed
Tommi2Day opened this issue Feb 14, 2024 · 4 comments
Closed

Connection Timeouts since 2.8.8 #513

Tommi2Day opened this issue Feb 14, 2024 · 4 comments
Labels

Comments

@Tommi2Day
Copy link

updated from 2.8.7 to 2.8.8 and my unit tests are terminating now with new errors:

  • connection break due to context timeout
    sample code
    `
    dbh, err = sqlx.Open(driver, source)
    if err != nil {
    return nil, err
    }

    // Create a context with timeout, using the empty
    // context.Background() as the parent.
    ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
    defer cancel()

    // Use this when testing the connection pool.
    if err = dbh.PingContext(ctx); err != nil {
    // error occours here
    return nil, err
    }
    `

source = 'oracle://dummy:dummy@:0/?connStr=%28DESCRIPTION%3D%28ADDRESS_LIST%3D%28ADDRESS%3D%28PROTOCOL%3DTCP%29%28HOST%3D127.0.0.1%29%28PORT%3D21522%29%29%29%28CONNECT_DATA%3D%28SERVER%3DDEDICATED%29%28SERVICE_NAME%3DFREEPDB1%29%29%29'

  • within select with real login: : ORA-01013: User requested cancel of current operation

Tested with Oracle23.3 Free. Timeout is set to 10 (sec)
I can confirm the same code is working with 2.8.7

@sijms sijms added fixing now working on this issue to fix fixed and removed fixing now working on this issue to fix labels Feb 14, 2024
@sijms
Copy link
Owner

sijms commented Feb 15, 2024

I find the bug
StartContext will create go-routine with each call
and EndContext should stop this go-routine using a stop channel
so I should create a stop-channel for each go-routine [the bug I use one stop channel for all]

@sijms
Copy link
Owner

sijms commented Feb 15, 2024

fixed in v2.8.9

@Tommi2Day
Copy link
Author

Tommi2Day commented Feb 16, 2024

Unfortunately, the first one of the errors is still alive even with 2.8.9
I am connecting with a wrong credential and expect a "ORA-01017" as return. But i still get the "connection break due to context timeout" error

@sijms
Copy link
Owner

sijms commented Feb 18, 2024

fixed in next release

@sijms sijms closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants