SqliteTransaction.Dispose() leaves an orphaned transaction instance in the connection if RollbackInternal() throws #25119
Labels
area-adonet-sqlite
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
poachable
punted-for-6.0
punted-for-7.0
Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints.
type-bug
Milestone
If the underling sqlite provider throws during a call to SqliteTransaction.Dispose(), then SqliteTransaction.Complete() is never called, and the transaction instance is left orphaned in the connection. This prevents any further transactions from being started on the connection.
I expect that the even if SqliteTransaction.RollbackInternal() throws, SqliteTransaction.Complete() is still called to clean up the connection before the exception leaves the Dispose() call frame.
The scenario where this may occur is with removable or network storage, where the storage the database file resides on has been removed or is otherwise unavailable just before a transaction is aborted/disposed for some reason. If access to the storage location is later restored, I would expect to be able to re-use the connection instance to issue new transactions against the database file.
repro project:
SqliteTransactionDisposeRepro.zip
version information
Microsoft.Data.Sqlite version: <= 5.0.7
Target framework: all targets
Operating system: all OS
The text was updated successfully, but these errors were encountered: