Skip to content

Nested transactions (transactionDepth > 1) can attempt to create and release multiple SAVEPOINTs with the same name #10209

@gmahomarf

Description

@gmahomarf

Issue description

Nested transactions (transactionDepth > 1) can attempt to create and release multiple SAVEPOINTs with the same name

Expected Behavior

When running nested transactions, each transaction should successfully start and end without issues

Actual Behavior

When running nested transactions, the transactionDepth counter is incremented/decremented incorrectly, leading to SAVEPOINTs with the same name. This eventually throws an exception when trying to release a SAVEPOINT that was released by another transaction.

Steps to reproduce

The test at test/github-issues/10209/issue-10209.ts in #10210, when run without the patches to the multiple QueryRunners, should reproduce the issue successfully

My Environment

Dependency Version
macOS 13.4.1
Node.js version 18.16.0
Typescript version 5.1.6
TypeORM version 0.3.17

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions