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

                 Key: DNET-833
                 URL: http://tracker.firebirdsql.org/browse/DNET-833
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 6.0.0.0
            Reporter: Daniel H
            Assignee: Jiri Cincura


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:

        [HttpGet]
        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);
                }
                ts.Complete();
            }
            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?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to