Repository navigation
fix(postgresql): avoid stale running-query errors after disconnect - #450
Closed
TywinLanni wants to merge 1 commit into
Closed
TywinLanni wants to merge 1 commit into
TywinLanni wants to merge 1 commit into
Conversation
2 tasks done
Contributor
|
Thanks @TywinLanni for reporting #449, putting together a clear reproduction, and tracking down the stale queryPromise on disconnect! While reviewing how this behaves end-to-end when a query times out inside a transaction without waiting for the channel close to finish, we noticed a few additional race windows across db-async-common and postgresql-async:
I opened #451 (with you credited as co-author) to cover the full timeout, disconnect, and transaction rollback lifecycle in one change. I suggest taking a look at #451 to review the approach and verify it covers your setup, and if it looks good you can close this PR in favor of #451. |
Contributor
Author
|
Thanks @oshai for such a quick response — I’m closing my MR in favor of yours. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
channelInactiveviaonDisconnect.Why
After a query timeout or channel close,
queryPromiseremained set. Reusing the same physical connection forROLLBACKthen failed withConnectionStillRunningQueryException(race -> false) even though no query was running.Fixes #449
Tests
:postgresql-async:test --tests "com.github.jasync.sql.db.postgresql.PostgreSQLConnectionLifecycleTest" --tests "com.github.jasync.sql.db.postgresql.codec.PostgreSQLConnectionHandlerTest":postgis-jasync:test --tests "com.github.aysnc.sql.db.integration.PostgisQueryTimeoutSpec":postgis-jasync:testpasses.The full
:postgresql-async:teststill has two pre-existing failures (LocalDateTimeassertion andSelfSignedCertificateSSL test). Both reproduce on cleanmasterwithout this change.