dotnet / runtime

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

[8.0] "InvalidOperationException: Category does not exist" failure in net48 win x86 in System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_IncrementBy_IncrementBy2 #103435

Open carlossanlop opened 3 weeks ago

carlossanlop commented 3 weeks ago

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=706881 Build error leg or test failing: System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_IncrementBy_IncrementBy2

Error Message

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

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

PR: https://github.com/dotnet/runtime/pull/103426 Job: https://dev.azure.com/dnceng-public/public/_build/results?buildId=706881&view=logs&j=885df564-30f3-5dad-0bdc-caf444244bdf&t=71aa97be-149e-50ab-5d1c-74d5540a091f&l=50 Job name: windows-x86 Release Libraries_NET48 Log: https://helixre107v0xd1eu3ibi6ka.blob.core.windows.net/dotnet-runtime-refs-pull-103426-merge-01018e12059a47ae96/System.Diagnostics.PerformanceCounter.Tests/1/console.bc703876.log?helixlogtype=result Output:

    System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_IncrementBy_IncrementBy2 [FAIL]
      System.AggregateException : One or more errors occurred.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : Category does not exist.
      ---- System.InvalidOperationException : 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(78,0): at System.Diagnostics.Tests.Helpers.RetryOnAllPlatforms[T](Func`1 func)
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(237,0): at System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_IncrementBy_IncrementBy2()
        ----- Inner Stack Trace #1 (System.InvalidOperationException) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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) -----
           at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
           at System.Diagnostics.PerformanceCounter.NextSample()
        /_/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs(243,0): at System.Diagnostics.Tests.PerformanceCounterTests.<>c__DisplayClass15_0.<PerformanceCounter_IncrementBy_IncrementBy2>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=706881 Error message validated: [System.InvalidOperationException : Category does not exist.] Result validation: :white_check_mark: Known issue matched with the provided build. Validation performed at: 6/13/2024 6:20:23 PM UTC

Report

Build Definition Test Pull Request
706881 dotnet/runtime System.Diagnostics.Tests.PerformanceCounterTests.PerformanceCounter_IncrementBy_IncrementBy2 dotnet/runtime#103426

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

There's a number of perfcounter issues with failure mode System.InvalidOperationException : Category does not exist. This is a common mode of flakiness for these tests. IIRC there's some loss-tolerance in the actual platform APIs that can cause this. I'm not sure the RetryHelper in use here helps, because I think the problem causes the static counter list in the process to be missing the counter category. https://github.com/search?q=repo%3Adotnet%2Fruntime+%22Category+does+not+exist%22&type=issues