Skip to content

Fix cgroupv1 acceptance test to explicitly register the v1 parser#7296

Merged
stephentoub merged 2 commits intomainfrom
copilot/fix-cgroup-v1-ci-failure
Feb 13, 2026
Merged

Fix cgroupv1 acceptance test to explicitly register the v1 parser#7296
stephentoub merged 2 commits intomainfrom
copilot/fix-cgroup-v1-ci-failure

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1 fails on cgroupv2 hosts because AddResourceMonitoring() auto-detects the host's cgroup version, not the fake filesystem's. On cgroupv2 CI machines, the v2 parser is registered and tries to read /sys/fs/cgroup/cpuset.cpus.effective — which doesn't exist in the v1 fake filesystem.

  • Add .Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV1>()) after AddResourceMonitoring(), matching the pattern the equivalent cgroupv2 test already uses at line 354 of the same file.
Original prompt

This section details on the original issue you should resolve

<issue_title>ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1 consistently failing in CI</issue_title>
<issue_description>```
System.InvalidOperationException : Could not parse '/sys/fs/cgroup/cpuset.cpus.effective'. Expected comma-separated list of integers, with dashes ("-") based ranges ("0", "2-6,12") but got ''.

Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.g__ThrowException|35_0(ReadOnlySpan1 content) Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetHostCpuCount() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxResourceQuotaProvider.GetResourceQuota() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationProvider..ctor(IOptions1 options, ILinuxUtilizationParser parser, IMeterFactory meterFactory, ResourceQuotaProvider resourceQuotaProvider, ILogger1 logger, TimeProvider timeProvider) InvokeStub_LinuxUtilizationProvider..ctor(Object, Span1)
System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.ResourceMonitorBuilder.<>c.<.ctor>b__3_1(IServiceProvider sp)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExte...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Microsoft Reviewers: Open in CodeFlow

The ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1
test was missing a .Replace() call to explicitly register the cgroupv1 parser.
On CI hosts running cgroupv2, AddResourceMonitoring() would detect cgroupv2 and
register the v2 parser, which then failed trying to read v2 paths from the fake
filesystem that only had v1 paths. This matches the pattern already used by the
equivalent cgroupv2 test.

Co-authored-by: stephentoub <[email protected]>
Copilot AI changed the title [WIP] Fix CI failure in ResourceUtilizationTracker with Cgroupsv1 Fix cgroupv1 acceptance test to explicitly register the v1 parser Feb 13, 2026
Copilot AI requested a review from stephentoub February 13, 2026 05:41
@stephentoub
Copy link
Member

@copilot, the tests should be robust to run on any machine, not just the ones currently or previously in CI

Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot, the tests should be robust to run on any machine, not just the ones currently or previously in CI

Agreed. The fix at 9357330 adds .Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV1>()) so the test explicitly registers the v1 parser instead of relying on host auto-detection. This matches the pattern all other tests in the file already use (lines 130, 179, 355, 455) — every test with a fake filesystem now explicitly registers the parser for the cgroup version it's testing, making them machine-agnostic.

@stephentoub stephentoub marked this pull request as ready for review February 13, 2026 11:45
@stephentoub stephentoub requested a review from a team as a code owner February 13, 2026 11:45
Copilot AI review requested due to automatic review settings February 13, 2026 11:45
@stephentoub stephentoub enabled auto-merge (squash) February 13, 2026 11:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Linux resource monitoring acceptance test that fails on cgroupv2 hosts by ensuring the cgroupv1 test explicitly uses the cgroupv1 utilization parser rather than relying on host cgroup auto-detection.

Changes:

  • Update the cgroupv1 acceptance test DI setup to replace ILinuxUtilizationParser with LinuxUtilizationParserCgroupV1 after AddResourceMonitoring().
  • Align the cgroupv1 test’s service registration pattern with the existing cgroupv2 acceptance test in the same file.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unblocking

@stephentoub stephentoub merged commit d7930d4 into main Feb 13, 2026
12 of 13 checks passed
@stephentoub stephentoub deleted the copilot/fix-cgroup-v1-ci-failure branch February 13, 2026 14:00
wtgodbe pushed a commit that referenced this pull request Feb 21, 2026
)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: stephentoub <[email protected]>
wtgodbe added a commit that referenced this pull request Feb 21, 2026
* Update SDK and dotnet version to 10.0.103

* Update public pipeline pool images to fix broken builds (#7292)

Update the pool image references in azure-pipelines-public.yml:
- Windows: windows.vs2022preview.amd64.open -> 1es-windows-2022-open
- Ubuntu: build.ubuntu.2004.amd64.open -> Build.Ubuntu.2204.Amd64.Open

The old images have been retired and are no longer available,
causing build failures. This matches the equivalent change made
in dotnet/aspire (PR #14486).

* Use smaller windows.vs2022.amd64.open image instead of 1es-windows-2022-open (#7298)

The 1es-windows-2022-open image is the large 'kitchen sink' image.
Switch to windows.vs2022.amd64.open which is the appropriate smaller
image for our build needs.

* Fix cgroupv1 acceptance test to explicitly register the v1 parser (#7296)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: stephentoub <[email protected]>

---------

Co-authored-by: William Godbe <[email protected]>
Co-authored-by: Jose Perez Rodriguez <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: stephentoub <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1 consistently failing in CI

5 participants