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

Attempting to rollback a connection that fails to get created #952

Open
mdnorman opened this issue Apr 16, 2024 · 1 comment
Open

Attempting to rollback a connection that fails to get created #952

mdnorman opened this issue Apr 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mdnorman
Copy link

mdnorman commented Apr 16, 2024

At this line, the beginTransaction call could fail, throwing an error that gets caught on line 570. The issue we are running into is that rollbackTransaction then gets called on a transaction that's not created yet. In the driver we're using, rolling back a transaction that's not created yet is considered an error.

I could go either way on this one, so is it a bug in the driver code that rollbackTransaction shouldn't throw an error if it's not in a transaction yet, or is it a bug to call rollbackTransaction when the transaction hasn't been created yet.

If the former, I'll go open an issue against the driver to put a fix in. If it's the latter, then I'm hoping it can get fixed here.

@koskimas
Copy link
Member

koskimas commented Apr 17, 2024

Nice catch (pun intended)! This should be fixed in Kysely.

On the other hand, beginTransaction can do multiple things. For example mysql creates a transaction and sets the isolation level using a separate query. If the second query fails, we still need to roll back the transaction.

But leaving this up to the driver seems risky too.

@koskimas koskimas added the bug Something isn't working label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants