runtime icon indicating copy to clipboard operation
runtime copied to clipboard

System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest crashes with Unhandled Exception on Linux

Open keeratsingh opened this issue 8 years ago • 3 comments

System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest crashes on Linux while executing the following tests: MultiThreadedCancel_NonAsync MultiThreadedCancel_Async

Both the tests crash in the method ExecuteCommandCancelExpected The same tests pass on windows, I am creating this GitHub issue to track and fix the tests.

Command to Reproduce:

<CoreFX Location>/Tools/msbuild.sh /t:RebuildAndTest /p:ConfigurationGroup=Release /p:XunitOptions="-method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_NonAsync"
<CoreFX Location>/Tools/msbuild.sh /t:RebuildAndTest /p:ConfigurationGroup=Release /p:XunitOptions="-method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_Async"

Logs MultiThreadedCancel_NonAsync:

keerats@ubuntu:/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests$ ~/dotnetcore/corefx/Tools/msbuild.sh /t:RebuildAndTest /p:ConfigurationGroup=Release /p:XunitOptions="-method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_NonAsync"
Microsoft (R) Build Engine version 15.5.179.9764 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Address -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Address/netstandard/Address.dll
  Circle -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Circle/netstandard/Circle.dll
  Shapes -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Shapes/netstandard/Shapes.dll
  Utf8String -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Utf8String/netstandard/Utf8String.dll
  System.Data.SqlClient.ManualTesting.Tests -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/System.Data.SqlClient.ManualTesting.Tests/netstandard/System.Data.SqlClient.ManualTesting.Tests.dll
  ----- start 10:37:27 =============== To repro directly: =====================================================
  pushd /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64
  chmod +x /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64//dotnet
  /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64//dotnet xunit.console.netcore.exe System.Data.SqlClient.ManualTesting.Tests.dll  -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_NonAsync  -notrait category=OuterLoop -notrait category=failing
  popd
  ===========================================================================================================
  /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64 /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests
  xUnit.net console test runner (64-bit .NET Core)
  Copyright (C) 2014 Outercurve Foundation.
  
  Discovering: System.Data.SqlClient.ManualTesting.Tests
  Discovered:  System.Data.SqlClient.ManualTesting.Tests
  Starting:    System.Data.SqlClient.ManualTesting.Tests
  
  Unhandled Exception: System.Data.SqlClient.SqlException: A severe error occurred on the current command.  The results, if any, should be discarded.
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlConnection.cs:line 1170
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs:line 1106
     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
     at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 2861
     at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 3121
     at System.Data.SqlClient.SqlDataReader.Read() in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 3083
     at System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.<>c__DisplayClass16_0.<ExecuteCommandCancelExpected>b__0() in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/CommandCancelTest/CommandCancelTest.cs:line 220
     at System.Data.SqlClient.ManualTesting.Tests.DataTestUtility.ExpectFailure[TException](Action actionThatFails, String exceptionMessage, Boolean innerExceptionMustBeNull, Func`2 customExceptionVerifier) in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs:line 159
     at System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.ExecuteCommandCancelExpected(Object state) in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/CommandCancelTest/CommandCancelTest.cs:line 226
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in /root/coreclr/src/mscorlib/shared/System/Threading/ExecutionContext.cs:line 166
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /root/coreclr/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 132
  /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/RunTests.sh: line 83:  2669 Aborted                 (core dumped) $RUNTIME_PATH/dotnet xunit.console.netcore.exe System.Data.SqlClient.ManualTesting.Tests.dll -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_NonAsync -notrait category=OuterLoop -notrait category=failing
  /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests
  ----- end 10:37:29 ----- exit code 134 ----------------------------------------------------------
/mnt/d/corefx/Tools/tests.targets(492,5): warning MSB3073: The command "/mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/RunTests.sh /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64/" exited with code 134. [/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj]
/mnt/d/corefx/Tools/tests.targets(500,5): error : One or more tests failed while running tests from 'System.Data.SqlClient.ManualTesting.Tests' please check /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/testResults.xml for details! [/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj]

Logs MultiThreadedCancel_Async:

keerats@ubuntu:/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests$ ~/dotnetcore/corefx/Tools/msbuild.sh /t:RebuildAndTest /p:ConfigurationGroup=Release /p:XunitOptions="-method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_Async"
Microsoft (R) Build Engine version 15.5.179.9764 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Address -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Address/netstandard/Address.dll
  Circle -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Circle/netstandard/Circle.dll
  Shapes -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Shapes/netstandard/Shapes.dll
  Utf8String -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/Utf8String/netstandard/Utf8String.dll
  System.Data.SqlClient.ManualTesting.Tests -> /mnt/d/corefx/bin/AnyOS.AnyCPU.Release/System.Data.SqlClient.ManualTesting.Tests/netstandard/System.Data.SqlClient.ManualTesting.Tests.dll
  ----- start 10:39:45 =============== To repro directly: =====================================================
  pushd /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64
  chmod +x /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64//dotnet
  /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64//dotnet xunit.console.netcore.exe System.Data.SqlClient.ManualTesting.Tests.dll  -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_Async  -notrait category=OuterLoop -notrait category=failing
  popd
  ===========================================================================================================
  /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64 /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests
  xUnit.net console test runner (64-bit .NET Core)
  Copyright (C) 2014 Outercurve Foundation.
  
  Discovering: System.Data.SqlClient.ManualTesting.Tests
  Discovered:  System.Data.SqlClient.ManualTesting.Tests
  Starting:    System.Data.SqlClient.ManualTesting.Tests
  
  Unhandled Exception: System.Data.SqlClient.SqlException: A severe error occurred on the current command.  The results, if any, should be discarded.
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlConnection.cs:line 1170
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs:line 1106
     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
     at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 2861
     at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 3121
     at System.Data.SqlClient.SqlDataReader.Read() in /mnt/d/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs:line 3083
     at System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.<>c__DisplayClass16_0.<ExecuteCommandCancelExpected>b__0() in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/CommandCancelTest/CommandCancelTest.cs:line 220
     at System.Data.SqlClient.ManualTesting.Tests.DataTestUtility.ExpectFailure[TException](Action actionThatFails, String exceptionMessage, Boolean innerExceptionMustBeNull, Func`2 customExceptionVerifier) in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs:line 159
     at System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.ExecuteCommandCancelExpected(Object state) in /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/CommandCancelTest/CommandCancelTest.cs:line 226
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in /root/coreclr/src/mscorlib/shared/System/Threading/ExecutionContext.cs:line 166
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /root/coreclr/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 132
  /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/RunTests.sh: line 83:  3044 Aborted                 (core dumped) $RUNTIME_PATH/dotnet xunit.console.netcore.exe System.Data.SqlClient.ManualTesting.Tests.dll -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -method System.Data.SqlClient.ManualTesting.Tests.CommandCancelTest.MultiThreadedCancel_Async -notrait category=OuterLoop -notrait category=failing
  /mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests
  ----- end 10:39:48 ----- exit code 134 ----------------------------------------------------------
/mnt/d/corefx/Tools/tests.targets(492,5): warning MSB3073: The command "/mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/RunTests.sh /mnt/d/corefx/bin/testhost/netcoreapp-Linux-Release-x64/" exited with code 134. [/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj]
/mnt/d/corefx/Tools/tests.targets(500,5): error : One or more tests failed while running tests from 'System.Data.SqlClient.ManualTesting.Tests' please check /mnt/d/corefx/bin/tests/System.Data.SqlClient.ManualTesting.Tests/netcoreapp-Linux-Release-x64/testResults.xml for details! [/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj]
keerats@ubuntu:/mnt/d/corefx/src/System.Data.SqlClient/tests/ManualTests$ 

@saurabh500 @geleems @corivera @AfsanehR

keeratsingh avatar Feb 28 '18 21:02 keeratsingh

@keeratsingh I found that the regression was introduced in https://github.com/dotnet/corefx/commit/cb00beea1104f58a909192b7ac868d8787526371

saurabh500 avatar Mar 01 '18 00:03 saurabh500

It was introduced in the PR https://github.com/dotnet/corefx/pull/27187

saurabh500 avatar Mar 01 '18 00:03 saurabh500

After reverting the change, I can execute the Manual tests without any failures in CommandCancelTests

saurabh500 avatar Mar 01 '18 00:03 saurabh500