Skip to content

.net core 2.1 The WriteAsync method cannot be called when another write operation is pending #509

Closed

Description

@cschotte

When I upgraded my project from .net core 2.0 to 2.1 I (sometimes) get this

System.NotSupportedException:
System.NotSupportedException:  The WriteAsync method cannot be called when another write operation is pending.
   at System.Net.Security.SslStreamInternal.WriteAsyncInternal[TWriteAdapter](TWriteAdapter writeAdapter, ReadOnlyMemory`1 buffer)
   at System.Net.Security.SslStreamInternal.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at MySqlConnector.Protocol.Serialization.StreamByteHandler.WriteBytesAsync(ArraySegment`1 data, IOBehavior ioBehavior) in C:\projects\mysqlconnector\src\MySqlConnector\Protocol\Serialization\StreamByteHandler.cs:line 87
--- End of stack trace from previous location where exception was thrown ---
   at MySqlConnector.Utilities.ValueTaskExtensions.ContinueWith[T,TResult](ValueTask`1 valueTask, Func`2 continuation) in C:\projects\mysqlconnector\src\MySqlConnector\Utilities\ValueTaskExtensions.cs:line 8
   at MySqlConnector.Core.ServerSession.DisposeAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 200
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 89
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 141
   at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 399
   at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 170
   at MySql.Data.MySqlClient.MySqlConnection.Open() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 156
   at BackOffice.Controllers.ApiController.GetCustomerList(Nullable`1 id) in C:\Dev\New Line Mobile\NewLineBilling\BackOffice\Controllers\ApiController.cs:line 43
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)

Activity

  1. bgrainger commented on Jun 6, 2018

    @bgrainger
    Member

    What version of MySqlConnector are you using?

  2. cschotte commented on Jun 6, 2018

    @cschotte
    Author

    v0.40.4 the exception is happening (sometimes) in the Connection.Open(); (i'm using SSL)
    MySQL Server version 5.7.21 (Azure)
    .NET Core 2.1.0

  3. bgrainger commented on Jun 6, 2018

    @bgrainger
    Member

    I wonder if SslStream in an earlier .NET Core version was throwing a different exception and it just happened to be caught here: https://github.com/mysql-net/MySqlConnector/blob/0.40.4/src/MySqlConnector/Core/ServerSession.cs#L196-L210

    It seems like a previous Write operation must have failed somehow, which is why the session is being cleaned up (after being retrieved from the pool), but I don't yet know exactly how this error is being triggered.

  4. bgrainger commented on Jun 7, 2018

    @bgrainger
    Member

    Are you able to collect logs (with ConsoleLoggerProvider or one of these options) of the failure and post them here?

  5. cschotte commented on Jun 8, 2018

    @cschotte
    Author
    ConnectionPool:Debug: Pool1 waiting for an available session
    ConnectionPool:Debug: Pool1 receiving Session1.2 back
    ConnectionPool:Debug: Pool1 found an existing session; checking it for validity
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 1263.5836ms 200 application/json; charset=utf-8
    ServerSession:Debug: Session1.1 ServerVersion=5.6.39.0 doesn't support reset connection; sending change user request
    ConnectionPool:Debug: Pool1 found an existing session; checking it for validity
    ServerSession:Debug: Session1.4 ServerVersion=5.6.39.0 doesn't support reset connection; sending change user request
    ServerSession:Debug: Session1.1 optimistic reauthentication failed; logging in again
    ServerSession:Debug: Session1.1 switching to AuthenticationMethod 'mysql_native_password'
    ServerSession:Debug: Session1.4 optimistic reauthentication failed; logging in again
    ServerSession:Debug: Session1.4 switching to AuthenticationMethod 'mysql_native_password'
    ConnectionPool:Debug: Pool1 returning pooled Session1.1 to caller; LeasedSessionsCount=1
    TextCommandExecutor:Debug: Session1.1 ExecuteBehavior Synchronous CommandText: SELECT *************
    ConnectionPool:Debug: Pool1 returning pooled Session1.4 to caller; LeasedSessionsCount=2
    TextCommandExecutor:Debug: Session1.4 ExecuteBehavior Synchronous CommandText: SELECT *************
    ServerSession:Debug: Session1.1 entering FinishQuerying; SessionState=Querying
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action method BackOffice.Controllers.ApiController.GetDeviceListForContract (BackOffice), returned result Microsoft.AspNetCore.Mvc.JsonResult in 93.1543ms.
    Microsoft.AspNetCore.Mvc.Formatters.Json.Internal.JsonResultExecutor:Information: Executing JsonResult, writing value of type '<>f__AnonymousType1`2[[System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.
    ServerSession:Debug: Session1.4 entering FinishQuerying; SessionState=Querying
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action BackOffice.Controllers.ApiController.GetDeviceListForContract (BackOffice) in 245.8154ms
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action method BackOffice.Controllers.ApiController.GetDeviceListForContract (BackOffice), returned result Microsoft.AspNetCore.Mvc.JsonResult in 263.1115ms.
    ServerSession:Debug: Session1.1 returning to Pool1
    Microsoft.AspNetCore.Mvc.Formatters.Json.Internal.JsonResultExecutor:Information: Executing JsonResult, writing value of type '<>f__AnonymousType1`2[[System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.
    ConnectionPool:Debug: Pool1 receiving Session1.1 back
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action BackOffice.Controllers.ApiController.GetDeviceListForContract (BackOffice) in 1509.4531ms
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 1403.9836ms 200 application/json; charset=utf-8
    ServerSession:Debug: Session1.4 returning to Pool1
    ConnectionPool:Debug: Pool1 receiving Session1.4 back
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 1683.3681ms 200 application/json; charset=utf-8
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:10836/Customer/  
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Route matched with {action = "Index", controller = "Customer"}. Executing action BackOffice.Controllers.CustomerController.Index (BackOffice)
    Microsoft.AspNetCore.Authorization.DefaultAuthorizationService:Information: Authorization was successful.
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executing action method BackOffice.Controllers.CustomerController.Index (BackOffice) - Validation state: Valid
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action method BackOffice.Controllers.CustomerController.Index (BackOffice), returned result Microsoft.AspNetCore.Mvc.ViewResult in 0.0263ms.
    Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor:Information: Executing ViewResult, running view Index.
    The program '' has exited with code -1 (0xffffffff).
    Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor:Information: Executed ViewResult - view Index executed in 5.7508ms.
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action BackOffice.Controllers.CustomerController.Index (BackOffice) in 223.05ms
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 272.4622ms 200 text/html; charset=utf-8
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:10836/Api/GetCustomerList?_=1528451143686  
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Route matched with {action = "GetCustomerList", controller = "Api"}. Executing action BackOffice.Controllers.ApiController.GetCustomerList (BackOffice)
    Microsoft.AspNetCore.Authorization.DefaultAuthorizationService:Information: Authorization was successful.
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executing action method BackOffice.Controllers.ApiController.GetCustomerList (BackOffice) with arguments () - Validation state: Valid
    ConnectionPool:Debug: Pool1 waiting for an available session
    ConnectionPool:Debug: Pool1 found an existing session; checking it for validity
    ServerSession:Debug: Session1.4 ServerVersion=5.6.39.0 doesn't support reset connection; sending change user request
    ServerSession:Debug: Session1.4 optimistic reauthentication failed; logging in again
    ServerSession:Debug: Session1.4 switching to AuthenticationMethod 'mysql_native_password'
    ConnectionPool:Debug: Pool1 returning pooled Session1.4 to caller; LeasedSessionsCount=1
    TextCommandExecutor:Debug: Session1.4 ExecuteBehavior Synchronous CommandText: SELECT *************
    ServerSession:Debug: Session1.4 entering FinishQuerying; SessionState=Querying
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action method BackOffice.Controllers.ApiController.GetCustomerList (BackOffice), returned result Microsoft.AspNetCore.Mvc.JsonResult in 126.1668ms.
    Microsoft.AspNetCore.Mvc.Formatters.Json.Internal.JsonResultExecutor:Information: Executing JsonResult, writing value of type '<>f__AnonymousType1`2[[System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.
    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action BackOffice.Controllers.ApiController.GetCustomerList (BackOffice) in 199.4792ms
    ServerSession:Debug: Session1.4 returning to Pool1
    ConnectionPool:Debug: Pool1 receiving Session1.4 back
    Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 280.5857ms 200 application/json; charset=utf-8
    The program '[692] dotnet.exe: Program Trace' has exited with code 0 (0x0).
    The program '[692] dotnet.exe' has exited with code -1 (0xffffffff).
    
  6. cschotte commented on Jun 8, 2018

    @cschotte
    Author

    The MySQL Server version is 5.7.21 (Azure), only the Logger is reporting ServerVersion=5.6.39.0 (if this is a MySQL version number)

  7. bgrainger commented on Jun 8, 2018

    @bgrainger
    Member

    The MySQL Server version is 5.7.21 (Azure), only the Logger is reporting ServerVersion=5.6.39.0 (if this is a MySQL version number)

    This is a known issue with Azure Database for MySQL (due to the proxy that's used): https://social.msdn.microsoft.com/Forums/security/en-US/795cb2be-dce7-4805-b324-a67e83697580/azure-database-for-mysql-reports-incorrect-version?forum=AzureDatabaseforMySQL

  8. bgrainger commented on Jun 8, 2018

    @bgrainger
    Member

    Just to confirm: the WriteAsync exception did happen during the period of time that log was collected? (Unfortunately, I don't think I see anything relevant yet.)

  9. bgrainger commented on Jul 6, 2018

    @bgrainger
    Member

    Just got this same error when targeting Azure:

    Failed   SideBySide.DataTypes.InsertLargeBlobSync(column: "LongBlob", size: 67108864)
    Error Message:
     System.NotSupportedException :  The WriteAsync method cannot be called when another write operation is pending.
    Stack Trace:
       at System.Net.Security.SslStreamInternal.WriteAsyncInternal[TWriteAdapter](TWriteAdapter writeAdapter, ReadOnlyMemory`1 buffer)
       at System.Net.Security.SslStreamInternal.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at MySqlConnector.Protocol.Serialization.StreamByteHandler.WriteBytesAsync(ArraySegment`1 data, IOBehavior ioBehavior) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/Protocol/Serialization/StreamByteHandler.cs:line 100
    --- End of stack trace from previous location where exception was thrown ---
       at MySqlConnector.Utilities.ValueTaskExtensions.ContinueWith[T,TResult](ValueTask`1 valueTask, Func`2 continuation) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/Utilities/ValueTaskExtensions.cs:line 8
       at MySqlConnector.Core.ServerSession.DisposeAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/Core/ServerSession.cs:line 204
       at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/Core/ConnectionPool.cs:line 89
       at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/Core/ConnectionPool.cs:line 141
       at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs:line 399
       at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs:line 171
       at MySql.Data.MySqlClient.MySqlConnection.Open() in /home/travis/build/mysql-net/MySqlConnector/src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs:line 157
    

    Since the exception is in GetSessionAsync, it may be related to a previous unit test.

    This occurred in the netcoreapp2.0 tests, so it may not strictly be related to netcoreapp2.1.

  10. cschotte commented on Jul 6, 2018

    @cschotte
    Author

    Next week I try to create a small test project, so we can easier trigger this event. Now I it looks random.

  11. cschotte commented on Jul 10, 2018

    @cschotte
    Author

    The following solution is (for now) working for me, needs more testing.

    public class Database : IDisposable
        {
            private readonly MySqlConnection db;
    
            public Database(string connectionString)
            {
                db = new MySqlConnection(connectionString);
    
                db.OpenAsync().GetAwaiter().GetResult();
            }
    
            public void Dispose()
            {
                db.Close();
            } 
    
  12. bgrainger commented on Jul 10, 2018

    @bgrainger
    Member

    Were you previously calling OpenAsync() without awaiting it? What was your previous code?

  13. cschotte commented on Jul 10, 2018

    @cschotte
    Author

    First my code was

    db.Open();

  14. hkurma commented on Aug 5, 2018

    @hkurma

    I'm facing the same issue as discussed above. My project is using .Net Core 2.1 and Azure MySql Database. I'm using Entity Framework for database communications and I added Pomelo.EntityFrameworkCore.MySql nuGet package as mentioned in this https://docs.microsoft.com/en-us/ef/core/providers/

    This issue is random as @cschotte said. But it is happening often for me. Any suggestions on how to solve it ? Below is stack trace of the Exception.

    System.NotSupportedException
      HResult=0x80131515
      Message= The WriteAsync method cannot be called when another write operation is pending.
      Source=System.Net.Security
      StackTrace:
       at System.Net.Security.SslStreamInternal.WriteAsyncInternal[TWriteAdapter](TWriteAdapter writeAdapter, ReadOnlyMemory`1 buffer)
       at System.Net.Security.SslStreamInternal.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at MySqlConnector.Protocol.Serialization.StreamByteHandler.WriteBytesAsync(ArraySegment`1 data, IOBehavior ioBehavior) in C:\projects\mysqlconnector\src\MySqlConnector\Protocol\Serialization\StreamByteHandler.cs:line 100
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySqlConnector.Utilities.ValueTaskExtensions.<ContinueWith>d__0`2.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Utilities\ValueTaskExtensions.cs:line 8
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySqlConnector.Core.ServerSession.<DisposeAsync>d__55.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 204
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySqlConnector.Core.ConnectionPool.<GetSessionAsync>d__10.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 89
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at MySqlConnector.Core.ConnectionPool.<GetSessionAsync>d__10.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 141
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySql.Data.MySqlClient.MySqlConnection.<CreateSessionAsync>d__89.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 399
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySql.Data.MySqlClient.MySqlConnection.<OpenAsync>d__25.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 171
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MySql.Data.MySqlClient.MySqlConnection.Open() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 157
       at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
       at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
       at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
       at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__17`2.MoveNext()
       at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
       at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at OnlinegymtimeAPI.Daos.CodesDao.GetCodesByCodeSetName(String codesetName) in D:\Development\OnlineGymtime\new\OnlinegymtimeAPI\OnlinegymtimeAPI\Daos\CodesDao.cs:line 25
       at OnlinegymtimeAPI.Controllers.CodesController.GetCodesByCodesetName(String codesetName) in D:\Development\OnlineGymtime\new\OnlinegymtimeAPI\OnlinegymtimeAPI\Controllers\CodesController.cs:line 28
       at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
       at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
    
  15. cschotte commented on Aug 5, 2018

    @cschotte
    Author

    Do not use the db.Open() in your code, in my project I fixed it by using db.OpenAsync().GetAwaiter().GetResult().

    Somehow in .net 2.1 and azure the normal db.Open is calling a async function international and is not waiting for it

  16. hkurma commented on Aug 5, 2018

    @hkurma

    I don't have db.OpenAsync() at all in my code since I'm using Entity Framework. How do I solve this ?

  17. hkurma commented on Aug 21, 2018

    @hkurma

    Can I expect a fix or solution for this issue? I'm using .NET Core 2.1, Entity framework and Azure MySQL.

  18. bgrainger commented on Aug 21, 2018

    @bgrainger
    Member

    I don't yet have enough information to reliably reproduce, diagnose, and fix the problem. Any more specific information you can provide would be helpful. Are you able to create a small example that reproduces the problem (e.g., when run in a loop)?

  19. bgrainger commented on Aug 21, 2018

    @bgrainger
    Member

    This same crash has been filed with SqlConnection: dotnet/corefx#27006

  20. bgrainger commented on Aug 21, 2018

    @bgrainger
    Member

    Looks like this exception is always throw from ServerSession.DisposeAsync. We were previously ignoring IOException #159 and ObjectDisposedException #411 in that method; I think the most straightforward workaround is to assume we may be in an inconsistent state and also ignore NotSupportedException.

  21. added 2 commits that reference this issue on Aug 21, 2018
    38008e6
    ff97012
  22. bgrainger commented on Aug 21, 2018

    @bgrainger
    Member

    Added a workaround in 0.44.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions