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

qe: improve error messages for closed transactions #3391

Merged
merged 14 commits into from Nov 23, 2022

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Nov 14, 2022

Make the error messages for closed transactions more detailed, add extra context about the transaction timeout.

Before:

  • Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a closed transaction..
    (also note the double "." at the end)

Now:

  • Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a committed transaction.
  • Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a transaction that was rolled back.
  • Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on an expired transaction. The timeout for this transaction was X ms, however Y ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.

Additionally, the "Transaction not found error" is now also more verbose, ref: https://www.notion.so/disconnect-with-iTX-f3cfee3ff4924e40aa90aadb2454e9fa?d=3bd7c7103b02461bbfe414a978a994c1#547ab127682b41898c87bdd5c841c0bf

This PR also contains minor cleanup things related to iTX I did along the way, I'm happy to move them to separate tiny PRs to reduce scope of this PR if you'd like:

Client PR: prisma/prisma#16382

Closes: prisma/prisma#13713
Ref: prisma/prisma#16050
Ref: #3028

@aqrln aqrln changed the title Improve error messages for closed transactions qe: improve error messages for closed transactions Nov 15, 2022
@aqrln aqrln added this to the 4.7.0 milestone Nov 16, 2022
@aqrln aqrln force-pushed the integration/closed-itx-error-message branch 2 times, most recently from 8eb3e1d to a0f321d Compare November 21, 2022 12:09
@aqrln aqrln marked this pull request as ready for review November 21, 2022 13:04
@aqrln aqrln force-pushed the integration/closed-itx-error-message branch from d97372b to a3aebd9 Compare November 21, 2022 13:12
@miguelff miguelff self-requested a review November 21, 2022 17:05
@miguelff
Copy link
Collaborator

Some tests fail because they expect a different error message. Other than that, the changes look correct.

aqrln added a commit to prisma/prisma that referenced this pull request Nov 21, 2022
Copy link
Member

@Weakky Weakky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, great job ✅

@aqrln aqrln merged commit fb37317 into main Nov 23, 2022
@aqrln aqrln deleted the integration/closed-itx-error-message branch November 23, 2022 10:42
aqrln added a commit to prisma/prisma that referenced this pull request Nov 23, 2022
@Raynos
Copy link

Raynos commented Oct 3, 2023

In production I get

no details about closed transaction

And it's a useless error message and going straight into my logs, I have no context here.

@Raynos
Copy link

Raynos commented Oct 3, 2023

The lack of A {from_operation} in the error message is really frustrating :(

@janpio
Copy link
Member

janpio commented Oct 4, 2023

Please open an issue over at https://github.com/prisma/prisma instead of commenting on a 11 months old, merged PR. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction API error: Transaction already closed: Transaction is no longer valid. Last state: 'Expired' P2028
5 participants