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

Environment variable should override property for gcServer. #61950

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Nov 23, 2021

Fixes #61674

Add tests for the scenario.

The added tests can also be used to validate any of the configuration properties and environment variables used for start-up.

/cc @cshung @elinor-fung

@jkoritzinsky and @trylek Can you please confirm the methodology in this new test works with the system being built?

@AaronRobinsonMSFT AaronRobinsonMSFT added this to the .NET 7.0 milestone Nov 23, 2021
@ghost
Copy link

ghost commented Nov 23, 2021

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

Issue Details

Add tests for the scenario.

Fixes #61674

/cc @cshung @elinor-fung

Author: AaronRobinsonMSFT
Assignees: -
Labels:

area-GC-coreclr

Milestone: .NET 7.0

Copy link
Member

@cshung cshung left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding the test!

@mangod9
Copy link
Member

mangod9 commented Nov 23, 2021

Thanks @AaronRobinsonMSFT for fixing, this feels like something we should queue up for 6.0.x. Thx!

@karelz karelz modified the milestones: .NET 7.0, 7.0.0 Nov 23, 2021
@AaronRobinsonMSFT AaronRobinsonMSFT merged commit 25ebdcf into dotnet:main Nov 23, 2021
@AaronRobinsonMSFT
Copy link
Member Author

/backport to release/6.0

@AaronRobinsonMSFT AaronRobinsonMSFT deleted the runtime61674 branch November 23, 2021 15:51
@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1495545849


[Fact]
[ConfigProperty("DOTNET_gcServer", "0")]
static int Verify_ServerGC_Env_Disable(string[] _)
Copy link
Member

@am11 am11 Nov 26, 2021

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@cshung this seems like something the GC team should investigate. I am unclear why this would be occurring but given the simplicity of the test I'd wager it is unlikely a test issue.

Copy link
Member

Choose a reason for hiding this comment

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

@mangod9 It looks like the GCStandAloneServer set COMPlus_gcServer=1, so even when the code set DOTNET_gcServer=0, we are still unable to disable it.

Copy link
Member

Choose a reason for hiding this comment

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

ok makes sense. @am11 what CI job was failing due to this issue? Is the failure only after this change or unrelated to this?

Copy link
Member

Choose a reason for hiding this comment

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

@mangod9, it's a new test added by this PR, which started to fail in outerloop test when this PR was merged. Perhaps the root-cause was preexisting and the test has surfaced the problem.

It looks like the GCStandAloneServer set COMPlus_gcServer=1, so even when the code set DOTNET_gcServer=0, we are still unable to disable it.

Based on the config parsing implementation:

// Priority order is DOTNET_ and then COMPlus_.
strcpy_s(nameBuffer, ARRAY_SIZE(nameBuffer), DOTNET_PREFIX_A);
fallbackPrefix = COMPLUS_PREFIX_A;
}
strcat_s(nameBuffer, ARRAY_SIZE(nameBuffer), cfg);
LPCSTR val = getEnvFptr != NULL ? getEnvFptr(nameBuffer) : getenv(nameBuffer);
if (val == NULL && fallbackPrefix != NULL)
{
strcpy_s(nameBuffer, ARRAY_SIZE(nameBuffer), fallbackPrefix);
strcat_s(nameBuffer, ARRAY_SIZE(nameBuffer), cfg);

first DOTNET_gcServer will be checked and if the value is NULL, it will fallback to legacy, COMPlus_gcServer. It is LPCSTR, so =0 shouldn't be confused by NULL/0, right?

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.

Garbage collection method is not manageable by environment variables in .net 6
5 participants