Bug #114390 Calling ef6 sync method with high concurrency would be deadlocking

Submitted: 18 Mar 2024 13:16 Modified: 25 Mar 2024 12:32
Reporter: Michael Scofield Scofield Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.3.0 OS:Windows (windows 11)
Assigned to: CPU Architecture:Any

[18 Mar 2024 13:16] Michael Scofield Scofield
Description:
asp.net webapp with ef6 and mysql.data.entityframework sync method like IQueryable.Count, IQueryable.ToList, in high concurrency the connection has on ressponse. 
eg:
        public int GetCount()
        {
            var count = SampleDbContext
                .Projects
                .AsQueryable()
                .Count();

            return count;
        }

How to repeat:
In asp.net mvc or webapi controller call this method        
        public ActionResult Index()
        {
            var count = SampleDbContext
                .Projects
                .AsQueryable()
                .Count();

            return View();
        }

Suggested fix:
In MySql.Data and MySql.Data.EnetityFramework
change the sync method likes
    public override bool Read() => ReadAsync(false, CancellationToken.None).GetAwaiter().GetResult();
to 
    public override bool Read() => ReadAsync(false, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();

or

use Fody.ConfigureAwait easily.
[19 Mar 2024 13:03] MySQL Verification Team
Hello Michael,

Thank you for the bug report.
Could you please provide complete repeatable test case to reproduce this issue at our end?

Regards,
Ashwini Patil
[25 Mar 2024 12:32] MySQL Verification Team
Hello Michael,

Thank you for the test code.
Verified as described.

Regards,
Ashwini Patil

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.