Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure: Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService #107240

Closed
v-wenyuxu opened this issue Sep 2, 2024 · 11 comments

Comments

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-pgo 20240901.1

Failed tests:

net9.0-windows-Release-arm64-defaultpgo-Windows.11.Arm64.Open
    - Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService

Error message:

 System.ServiceProcess.TimeoutException : The operation requested for service 'CanCreateService' has not been completed within the specified time interval.

Stack trace:

   at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs:line 994
   at Microsoft.Extensions.Hosting.WindowsServiceTester.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs:line 58
   at Microsoft.Extensions.Hosting.WindowsServiceTester.WaitForStatus(ServiceControllerStatus desiredStatus) in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs:line 54
   at Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService() in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs:line 47
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Sep 2, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-hosting
See info in area-owners.md if you want to be subscribed.

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr libraries-jitstress 20240902.1

Failed tests:

net9.0-windows-Release-arm64-jitminopts-Windows.11.Arm64.Open
    - Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService

Error message:

 System.ServiceProcess.TimeoutException : The operation requested for service 'CanCreateService' has not been completed within the specified time interval.

Stack trace:

   at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs:line 994
   at Microsoft.Extensions.Hosting.WindowsServiceTester.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs:line 58
   at Microsoft.Extensions.Hosting.WindowsServiceTester.WaitForStatus(ServiceControllerStatus desiredStatus) in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs:line 54
   at Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService() in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs:line 47
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@steveharter
Copy link
Member

steveharter commented Sep 3, 2024

Appears to be duplicate of #103548 which was recently fixed in 10.0 and backported to 9.0. That may need to be re-opened.

The failure above is from 9.0: net9.0-windows-Release-arm64-jitminopts-Windows.11.Arm64.Open

@steveharter
Copy link
Member

cc @ericstj

@ericstj
Copy link
Member

ericstj commented Sep 3, 2024

Failing in main too - service is not starting after waiting 3 minutes. I'm inclined to believe that something about the environment here is causing the test to fail. I'll see if I can repro locally by pulling down the test payload from these jitminopts runs.

@ericstj ericstj self-assigned this Sep 4, 2024
@ericstj ericstj added this to the 9.0.0 milestone Sep 4, 2024
@ericstj
Copy link
Member

ericstj commented Sep 4, 2024

No repro on x64 - need to have a look on arm64. Could be something with how the service configuration/installation is working there.

@ericstj ericstj removed the untriaged New issue has not been triaged by the area owner label Sep 4, 2024
@ericstj
Copy link
Member

ericstj commented Sep 4, 2024

I tested on an arm64 machine and it works here:

D:\scratch\serviceRepro\workitems\Microsoft.Extensions.Hosting.WindowsServices.Tests>"D:\scratch\serviceRepro\.\correlation-payload\dotnet.exe" exec --runtimeconfig Microsoft.Extensions.Hosting.WindowsServices.Tests.runtimeconfig.json --depsfile Microsoft.Extensions.Hosting.WindowsServices.Tests.deps.json xunit.console.dll Microsoft.Extensions.Hosting.WindowsServices.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
  Discovering: Microsoft.Extensions.Hosting.WindowsServices.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  Microsoft.Extensions.Hosting.WindowsServices.Tests (found 12 test cases)
  Starting:    Microsoft.Extensions.Hosting.WindowsServices.Tests (parallel test collections = on [8 threads], stop on fail = off)
  Finished:    Microsoft.Extensions.Hosting.WindowsServices.Tests
=== TEST EXECUTION SUMMARY ===
   Microsoft.Extensions.Hosting.WindowsServices.Tests  Total: 12, Errors: 0, Failed: 0, Skipped: 0, Time: 10.625s

I used the exact same test payload from the failing machine. I'm now running in a loop to determine if there's a timing issue at play. I don't really see how that could happen here though - it's waiting for the service to start so even if the service started early or late - it should still sync up. My best guess is that the service is failing to start in a way that's missed by the SCM API. If I cannot reproduce it we can add some more diagnostics here in hopes we can gather more info in case of a failure.

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr libraries-jitstress-random 20240904.1

Failed tests:

net9.0-windows-Release-arm64-jitstress_random_2-Windows.11.Arm64.Open
    - Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService

Error message:

 System.ServiceProcess.TimeoutException : The operation requested for service 'CanCreateService' has not been completed within the specified time interval.

Stack trace:

   at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs:line 994
   at Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService() in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs:line 47
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr libraries-jitstressregs 20240908.1

Failed tests:

net9.0-windows-Release-arm64-jitstressregs2-Windows.11.Arm64.Open
    - Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService

Error message:

 System.ServiceProcess.TimeoutException : The operation requested for service 'CanCreateService' has not been completed within the specified time interval.

Stack trace:

   at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) in /_/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs:line 994
   at Microsoft.Extensions.Hosting.UseWindowsServiceTests.CanCreateService() in /_/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs:line 47
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@mikelle-rogers
Copy link
Member

@ericstj, thanks for continuing to look into the test failure!

@ericstj
Copy link
Member

ericstj commented Sep 12, 2024

Probably the root cause here is the same as #107671. The process is hanging. Neither the test nor Service nor Extensions libraries are on the stack. I could use help from someone taking a look at the dump who has more SOS-fu than this tired manager. Any takers?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants