dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.69k stars 4.59k forks source link

[8.0] Failure in `System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment`: Category 'PerformanceCounter_Increment_Category' does not exist. #104572

Open kouvel opened 3 weeks ago

kouvel commented 3 weeks ago

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=731587 Build error leg or test failing: System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment Pull request: https://github.com/dotnet/runtime/pull/103984

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Error output

Info: Successfully uninstalled the performance counters from the counter definition XML file C:\h\w\A4A0097E\t\pv4sxcea.r50\provider.man.    System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment [FAIL]
      System.AggregateException : One or more errors occurred. (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.)
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.
      Stack Trace:
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(54,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(73,0): at System.Diagnostics.Tests.Helpers.RetryOnAllPlatforms[T](Func`1 func)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(36,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
        ----- Inner Stack Trace #1 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #2 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #3 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #4 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #5 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #6 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #7 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #8 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #9 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)
        ----- Inner Stack Trace #10 (System.InvalidOperationException) -----
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs(829,0): at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs(545,0): at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(228,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass14_0.<PerformanceCounter_Increment>b__1()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/Helpers.cs(75,0): at System.Diagnostics.Tests.Helpers.<>c__DisplayClass12_0`1.<RetryOnAllPlatforms>b__0()
        /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs(45,0): at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName)

Known issue validation

Build: :mag_right: https://dev.azure.com/dnceng-public/public/_build/results?buildId=731587 Error message validated: [System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.] Result validation: :white_check_mark: Known issue matched with the provided build. Validation performed at: 7/8/2024 8:03:26 PM UTC

Report

Build Definition Test Pull Request
731587 dotnet/runtime System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment dotnet/runtime#103984

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 1
dotnet-policy-service[bot] commented 3 weeks ago

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

ericstj commented 2 weeks ago

Singe instance of a failure, looks to me like test failed to missing counter installation:

Info: Successfully installed performance counters in C:\h\w\A4A0097E\t\pv4sxcea.r50\provider.man    System.Diagnostics.Tests.PerformanceDataTests.PerformanceCounter_PerformanceData [SKIP]
      Condition(s) not met: "IsRunnableEnvironment"

Info: Successfully uninstalled the performance counters from the counter definition XML file C:\h\w\A4A0097E\t\pv4sxcea.r50\provider.man.    System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_Increment [FAIL]
      System.AggregateException : One or more errors occurred. (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.) (Category 'PerformanceCounter_Increment_Category' does not exist.)
      ---- System.InvalidOperationException : Category 'PerformanceCounter_Increment_Category' does not exist.

It looks to me like Xunit disposed the counters before running the test. It shouldn't, if I understand how text fixtures work: https://github.com/dotnet/runtime/blob/66ae90f3b7ec4f13fffcd71913eca0b45777e58c/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs#L203-L253

Leaving this open to see about hit count. If we see more of this we should investigate why the PerformanceDataTestsFixture is disposed before finishing tests.