Skip to content

GCSettings not being honored #92458

Closed
Closed

Description

@TVAUGHN2

Description

Looks like the issue from #84198 is reintroduced. Verified by outputting GC configs the same way as mentioned in that ticket.

My generated runtime config:

{
  "runtimeOptions": {
    "tfm": "net7.0",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "7.0.0"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "7.0.0"
      }
    ],
    "configProperties": {
      "System.GC.HighMemoryPercent": 75,
      "System.GC.Server": true,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

Output generated:

ServerGC:False
ConcurrentGC:True
RetainVM:False
NoAffinitize:False
GCCpuGroup:False
GCLargePages:False
HeapCount:1
GCHeapAffinitizeMask:0
GCHeapAffinitizeRanges:
GCHighMemPercent:0
GCHeapHardLimit:0
GCHeapHardLimitPercent:0
GCHeapHardLimitSOH:0
GCHeapHardLimitLOH:0
GCHeapHardLimitPOH:0
GCHeapHardLimitSOHPercent:0
GCHeapHardLimitLOHPercent:0
GCHeapHardLimitPOHPercent:0
GCConserveMem:0

Verified the runtime was being picked up by toggling the System.GC.Server to false.

When I toggled that to false, it was recognized

Output when setting System.GC.Server to false

ServerGC:False
ConcurrentGC:True
RetainVM:False
NoAffinitize:False
GCCpuGroup:False
GCLargePages:False
HeapCount:1
GCHeapAffinitizeMask:0
GCHeapAffinitizeRanges:
GCHighMemPercent:0
GCHeapHardLimit:0
GCHeapHardLimitPercent:0
GCHeapHardLimitSOH:0
GCHeapHardLimitLOH:0
GCHeapHardLimitPOH:0
GCHeapHardLimitSOHPercent:0
GCHeapHardLimitLOHPercent:0
GCHeapHardLimitPOHPercent:0
GCConserveMem:0

Reproduction Steps

  1. An app that generates a runtime config with System.GC.Server = true
  2. Add logging a la:
foreach (var kvp in System.GC.GetConfigurationVariables())
{
    System.Console.WriteLine(kvp.Key + ":" + kvp.Value);
}
  1. Create a runtimeconfig.template.json file setting System.GC.HighMemoryPercent = 75
  2. Run dotnet build and check the runtimeconfig.json file (it should have the variable)
  3. Run the app and check the output results

Expected behavior

Expect the config value to be honored

Actual behavior

Config value is not being honored

Regression?

Not certain, the related fi from before was here: #84201

But not certain what version was before that fix to text

Known Workarounds

No response

Configuration

My sdk:
7.0.401 [/usr/local/share/dotnet/x64/sdk]

My runtime:
Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

OS
MacOS Ventura 13.5.1

Architecture
Apple M1 Pro, but running via x64 architecture

Other information

Also verified not working in Linux environment, so if unable to reproduce can grab some more info

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Sep 22, 2023
  2. TVAUGHN2 commented on Sep 26, 2023

    @TVAUGHN2
    Author

    Hi - team, any thoughts on this? I tried setting environment variables locally as a workaround as well and looks like they weren't being picked up either.

  3. MokoSan commented on Sep 26, 2023

    @MokoSan
    Contributor

    Hi @TVAUGHN2, we'll need to backport the fix to the Configuration API to Net 7.0. Can you confirm if the settings are honored with .NET 8?

  4. TVAUGHN2 commented on Sep 27, 2023

    @TVAUGHN2
    Author

    Hey @MokoSan - yes verified it works in .NET 8

    { "ServerGC": true, "ConcurrentGC": true, "RetainVM": false, "NoAffinitize": false, "GCCpuGroup": false, "GCLargePages": false, "HeapCount": 10, "GCHeapAffinitizeMask": 0, "GCHeapAffinitizeRanges": "", "GCHighMemPercent": 75, "GCHeapHardLimit": 0, "GCHeapHardLimitPercent": 0, "GCHeapHardLimitSOH": 0, "GCHeapHardLimitLOH": 0, "GCHeapHardLimitPOH": 0, "GCHeapHardLimitSOHPercent": 0, "GCHeapHardLimitLOHPercent": 0, "GCHeapHardLimitPOHPercent": 0, "GCConserveMem": 0, "GCName": "", "GCDynamicAdaptationMode": 0 }

  5. MokoSan commented on Sep 27, 2023

    @MokoSan
    Contributor

    Thanks for confirming, @TVAUGHN2! Do let us know if you would like this ported back to .NET 7. Thank you!

  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 28, 2023
  7. added this to the Future milestone on Sep 28, 2023
  8. mrsharm commented on Jan 9, 2024

    @mrsharm
    Contributor

    Closing this issue - please feel free to reopen in case you have any other questions / suggestions.

  9. locked and limited conversation to collaborators on Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions