-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
DOTNET_PROCESSOR_COUNT
is a hex value -- should be decimal
#53150
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@richlander we need to be careful here. All config values in env variables that .NET supports are hexadecimal and and it was this way forever. So changing it to decimal would be a breaking change for many people. Unless we start treating the env vars prefixed by |
I didn't know that. If that's the case, that's fine. I was looking at the behavior from the myopic viewpoint of this scenario. I'm OK just documenting this behavior. I'll close the issue. If others have an alternate view, feel free to offer that. |
That was true for the existing So we are going to have inconsistency here in any case. I think we should use the more sensible convention (ie decimal by default) for anything new, especially if it is going to be used frequently like |
Almost all numeric runtime/src/coreclr/pal/src/init/pal.cpp Lines 413 to 415 in 01b7e73
runtime/src/coreclr/utilcode/clrconfig.cpp Line 241 in 01b7e73
We have this behavior documented for GC configuration settings ( COMPlus_GCHeapCount , COMPlus_GCHeapHardLimit ,COMPlus_GCHeapHardLimitPercent , COMPlus_GCHighMemPercent , etc.):
For a couple of other numeric options we have added custom processing to treat them as decimal. I do not have a strong opinion here, but I do not see why it could be unexpected for the
I consider using this setting rather an advance scenario. |
I think this is a bit confusing statement given that for most configuration settings Also I may be missing something but I found only two numeric
While this
Update: It seems that |
Here's a good principle:
One could imagine building a Monte Carlo machine to validate best performance. If you log Environment.ProcessorCount, then that value and the value you used for the ENV won't match. That's super unfortunate. I'm essentially articulating round-tripping of data. I don't think it's super useful to focus on how the system work, but focus on what we think the best UX is. You've particularly that there is a mix today of approaches. Which approach do we like best? |
Decimals would obviously be more user friendly for stuff like counts and less user friendly for bitmasks. We use the env vars for both kinds of values. I am starting to think that it would make sense to handle the |
+1 We have done the grand unification of @AaronRobinsonMSFT Thoughts? |
Agree.
Processing the radix is possible, although I am unsure how valuable in practice.
I am leery of having the prefix dictate the semantic here. It wouldn't be hard to add a flag that says "interpret as dec" and default to hex. This would take me about 30 minutes to add. Basically have the definer of the config setting state what base they want to use. I would argue the cases where both radix types should be supported for a config are close to 0. |
That only works if you have one and only party setting the configs. If you have two different parties setting the different configs, how are they going to agree on what to use? |
Are you referring to the case where we have a groups of people that have a preference between hex or dec? I don't see that as a reality. Each config has a historical format - prior to the unification of |
The numeric type here is
They would match if you log it using the same base, i.e. as a hexadecimal number.
If I designed from scratch, I would likely parse numbers as decimal by default and allow the |
There are two meanings of Your answer appears to be missing that point. |
Per-setting flag would be a cleaner alternative to existing custom processing as decimal here and there.
You might be thinking about a separate flag affecting parsing all settings, but that is not what was suggested here. |
There is a dedicated |
My primary point was that the numeric form of the ENV and the property should match. They don't currently. One is hex and the other is decimal, as I called out. |
DOTNET_PROCESSOR_COUNT
is treated as a hex value. That's unexpected and likely to surprise users. It should be changed to a decimal value.Context: #53149
The text was updated successfully, but these errors were encountered: