Closed kahuang closed 3 years ago
I've updated the tests and squashed the commits
Need to remove go 1.13 which doesn't support some of the sync stuff here. Doing that in #1014.
This change causes a public API change that breaks our app.
We start a transaction in a WithCancel() context, run a select, cancel the context, and run another select.
The error returned when transacting on a canceled context used to be:
"sql: transaction has already been committed or rolled back"
It is now instead "driver: bad connection"
which is not just a breaking change, but arguably the wrong error.
If you submit a PR that reverts this change and adds a test to prevent this regression in the future I'll merge it.
Hello.
It's possible that connections remain in the pool in the ErrBadConn
state and
a connection drop out in the next request.
Should we implement the SessionResetter
in this case?
This change causes a public API change that breaks our app.
We've just run into the same issue inside CockroachDB. A query cancellation should not drop the connection.
I think https://github.com/lib/pq/pull/1079 will address the issues with this PR
I have updated #1079 with the code review comments in case it helps.
This change solves the following issue we were seeing in production:
The changes I've made to ensure we don't run into this collateral damage:
Note: We probably don't need to change
bad
to an atomic variable, but I did just to be safe.