aspnetcore: DistrubutedSession error: A severe error occurred on the current command. The results, if any, should be discarded. Operation cancelled by user.
I’m getting an error in DistributedSession. The source of the error seems to come from Cancellation tokens. There was discussion on quieting some of the noisy logs coming from cancellation tokens here in Session Issue 189
I’m wondering if the same can be done for this error? Or, if not, how can I handle this error myself?
I’ll keep trying, but so far, I’m unable to reproduce.
Exception Message: A severe error occurred on the current command. The results, if any, should be discarded. Operation cancelled by user. Stack trace:
System.Data.SqlClient.SqlException (0x80131904): A severe error occurred on the current command. The results, if any, should be discarded. Operation cancelled by user.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption)
at System.Data.SqlClient.SqlCommand.InternalEndExecuteReader(IAsyncResult asyncResult, String endMethod, Boolean isInternal)
at System.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult)
at System.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.Caching.SqlServer.SqlServerCache.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Session.DistributedSession.d__32.MoveNext()
The IIS logs also show this message in addition to stack trace: Session cache read exception
I found a test that tests for this message, if that helps.
asp.net core 2.1 MVC site with DistributedSqlServerCache. Session is backed by SqlServer.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Ignore RequestAborted on Session commit #3479 — committed to dotnet/aspnetcore by Tratcher 5 years ago
- Ignore RequestAborted on Session commit #3479 (#11858) — committed to dotnet/aspnetcore by Tratcher 5 years ago
That usually means the client disconnected, causing the session commit to be aborted.
@anurse we do need to address this, it’s causing a lot of unnecessary noise.
I’ve the same issue in our environment. Is there any way to avoid this exception at least temporary. An also, what is the initial reason of this issue?
Same issue also now appears in our environment after upgrading Microsoft.AspNetCore.Session from 2.0.2 to 2.1.1.
Same issue in our environment.