Skip to content

Unexpected 'AlreadyInTransaction' after serializaiton error on commit #241

Open
@lsunsi

Description

@lsunsi

Setup

Versions

  • Rust: 1.87
  • Diesel: 2.2.11
  • Diesel_async: 0.5.2
  • Database: postgresql 17
  • Operating System: linux / fedora

Feature Flags

  • diesel: none
  • diesel_async: postgresql

Problem Description

After some specific serialization errors, the connection seems to have an open transaction when I'd expect it to be clean and ready to re-use. Most serialization errors have this behavior, incurring in a rollback so you can retry the transaction but sometimes it doesn't.

What are you trying to accomplish?

I'm attempting to retry transactions that yield serialization failures on execution.

What is the expected output?

I expect the connection used on the transaction to always be unbroken and clean after running the transaction despite the transaction on itself having failed due to serialization.

What is the actual output?

Sometimes the connection is left with an open transaction, resulting in a AlreadyInTransaction on trying to use it again.

Are you seeing any additional errors?

No, anything else.

Steps to reproduce

https://github.com/lsunsi/diesel-serialization-error-corruption-reproduction

Checklist

  • I have already looked over the issue tracker for similar possible closed issues.
  • This issue can be reproduced on Rust's stable channel. (Your issue will be
    closed if this is not the case)
  • This issue can be reproduced without requiring a third party crate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions