Issue Details (XML | Word | Printable)

Key: DNET-833
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Daniel H
Votes: 1
Watchers: 1

If you were logged in you would be able to see more operations.
.NET Data provider

"Unable to enlist in transaction, a local transaction already exists" in multithreaded environments

Created: 05/Jul/18 10:48 AM   Updated: 05/Jul/18 10:48 AM
Component/s: ADO.NET Provider
Affects Version/s:
Fix Version/s: None

 Description  « Hide
We are developing an ASP.NET Core (.NET Core Version 2.1.1) web application.
We are using a Firebird 3 Connection Pool with the following options in the connection string:

- Pooling: True
- MinPoolSize: 0
- MaxPoolSize: 50
- Auto_Commit: false
- Enlist: true

On serveral occasions we receive the following exception:
"Unable to enlist in transaction, a local transaction already exists".

This happens in our minimal breaking exampple, if we call the following code with a few threads over HTTP GET:

        public async Task<IActionResult> GetX()
            IEnumerable<string> x= null;
            using (var ts = new TransactionScope( TransactionScopeAsyncFlowOption.Enabled))
                using (var connection = new FbConnection(connectionString))
                    roles = await connection.QueryAsync<string>(
                        sql: "SELECT strField FROM X",
                        commandType: CommandType.Text);
            return Ok(x);

If we encapsulate the TransactionScope block with a Semaphore it runs fine.
Therefore the question: Does this library supporting multithreading or do we need to protect Firebird calls with a semaphore?

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.