-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Can we rename COMPlus_ to DOTNET_ for environment variables? #47283
Comments
COMPLUS used in code can also be renamed, for example COMPLUSTHROW. This can have less impact. |
I think I suggested this a while back as we have some I think it comes down to whether these are temporary things that aren't really documented, where names don't matter much, or they are supported dials and it seems increasingly some of them are de-facto supported and it's confusing. |
In case of the rename it should be double-checked if / how this interferes with Generic Host configuration. Just to be on the safe side. |
It also occurs to me, is it clear enough which are supported and which are not? Is it simply - which ones are documented? Eg., COMPlus_GCRetainVM is documented even though in the code it is |
Maybe CLR_ instead of DOTNET_? |
How about create dummy ones that loop back to the renamed ones but mark them as obsolete to warn the users against using them (and have it state the renamed copy)? |
The LTS vs non-LTS fact shouldn't be considered here. |
there may be cases where both CoreCLR and Mono have the same flag, particularly as we share more code. I would expect DOTNET_ may be a better prefix in that case. |
@jkotas, this primarily impacts usage in the runtime. How do you feel about it? Great idea and we should make it happen for .NET 6, terrible idea that's not worth pursuing any further, something in the middle? |
It sounds good to me, assuming that we also look for COMPlus for the time being. @AaronRobinsonMSFT Do you plan to work on this? Also, there is still the code that reads the config from the .NET Framework registry hive. We should get rid of that while we are on it, without replacement. I am not aware of anybody using it for .NET Core config, and we have never documented it as such. |
Yep. I am going to add this to my list. I will put out a proposal for how to do this in a few steps. We have a decent number of partners that will need to be informed.
Agree. |
@jkotas and @stephentoub Proposal for this work is here. |
This would be problematic if a customer is using the same scripts or environment or container for both .NET Framework (or pre NET 6) workloads. I suggest this logging not happen if there are matching old and new variables set and they have the same value. |
Thanks!
I'm ok with that if it's deemed really necessary, but personally I think this is overly conservative. I was hoping instead it could be two releases: .NET 6 respects both, .NET 7 just respects DOTNET_. Supporting both in a long-term servicing release gives folks ample time to update without being forced to accept a breaking change, which should only impact a relatively very small, advanced, hopefully-well-informed set of users.
We should only fall through to look for COMPlus_XYZ at all if we looked for DOTNET_XYZ and didn't find it.
I imagine writing to stdout could be an even larger breaking change ;-)
You might want to sync with @marklio. We should be able to figure out what, if any, nuget packages might be setting some of these so we can follow-up with those owners more proactively. I expect the number to be super low, since these mostly affect new processes started, so it would end up being something probably with Process.Start. Part of VS diagnostics you already called out, but just highlighting that your old stomping ground in the VS .NET allocation profiler exposes an option on by default for disabling R2R. It should likely be updated to just set both for the foreseeable future; I expect most tools that aren't tied to a particular .NET release will need to do the same. |
+CodeGen team. The env variables are heavily used for testing the JIT itself, and also recommended way to exercise hardware-intrinsics specific code-paths for library developers. It is likely that every more substantial .NET project out there is going to have
I agree with Dan that introducing any logging for this sounds problematic. I think we should just look for
The extra code to check for COMPlus in addition to DOTNET is <10 lines. It does not seem like a energy well spent to chase down all places that use COMPlus to be able to delete these 10 lines. I would actually not mind if keep the COMPlus check forever as legacy quirk and spend time on things with better ROI instead. |
I think there's value in finding and fixing most occurrences. I don't want us to be in a https://imgs.xkcd.com/comics/standards.png position where two different variants of these are sprinkled everywhere and folks don't know why you'd use which when. That said, if there's minimal overhead impact from doubling the number of env var checks we make in the common case (since most of the env vars will never be set), and if we can stomp out the vast majority of the uses of the old ones folks will ever see (in dotnet/runtime, in docs, etc.), I'd be ok for the foreseeable future having COMPlus always there as a fallback stopgap.
Yes, at least any logging to something like stdout that is frequently programmatically consumed, or even visible to an end user. I wouldn't have qualms with logging to debugger output if it was deemed important, but I don't think it's that important. |
It's only important when running in debug but that would inform developers of the change so then they would set the newer one. |
I agree. I think it is very similar to APIs. We have number of places where we have introduced new APIs that are replacements for existing APIs. We have analyzers to help you to move to the new APIs, etc. But we are very reluctant to remove any APIs since chasing down and fixing all places is not worth the energy spent.
Yes, there is very minimal overhead from checking for both. The runtime indexes all env variables during startup using a bloom filter. |
@danmoseley @stephentoub @jkotas I hear all of you, but don't agree. Pushing users to the correct approach is important here and I don't see the cost being too high for them which is why it was stated for Basically we are saying that users can install .NET 6, set an environment variable with the
Updated.
That is reasonable and I've no qualms with that. |
e.g. When the user doesn't own the code / binary that's setting the environment variables. Imagine for example app A launches app B with stdout redirected, parsing the response, and it launches app B with the COMPlus environment variable. That app breaks, the user has no idea why. |
Or when you are a first party customer (it is fairly common to first parties to use COMPlus settings), running on .NET 5 by default, and want to flight .NET 6 (something we are encouraging first parties to do). Flighting .NET 6 is not just about flipping the runtime anymore, you have to also figure out how to change your deployment scripts to set COMPlus vs. DOTNET, or deal with the message appearing in all logs. |
In particular |
LGTM |
Certainly, removing the breaking aspect of the change alleviates my concerns for this release. Is the proposal that we will continue to support COMPlus_ in future releases? Or are will still thinking of pulling support at some point? |
From the code I've looked at the cost to search for
Personally, I think we should pull it at some point - .NET 8 or .NET 9? I will say it would be a low priority thing given the cost to search for both so perpetually below the cut line for the core runtime team. That being said, do you have a suggestion on how we could make eventual removal easy when the resourcing for the effort is found? |
From a tooling side I would be pretty against logging an error message. Currently in the Visual Studio profiler we set COMPLUS* variables for our .NET Allocation tool. To support new and old runtimes we would probably just set both since that is the easiest thing to do and doesn't require a runtime version check which can be error prone for us. Positing an error message is pretty much guaranteed to confuse some folks as to why they get an error message with the tool that they don't without. |
I am really confused here. This would literally never happen if a |
Oh sorry, looks like I miss understood. After reading:
I was under the impression that the presence of a COMPlus variable would generate the stdout. If we set them to the same value or the presence of a DOTNET variable suppresses the error we are good. |
If we felt the value in getting people off of COMPlus_ was high and we needed a successful migration, I'd suggest our approach should look like:
I still think we'd need to have "compat" mode in perpetuity. Any other tooling that's not runtime is unlikely to be successful due to the "ambient" nature of environment variables. It's quite likely that infrastructure that manages environment variables is never presented to the SDK in any meaningful way (ex. in a management portal somewhere) Due to the mixed Framework/Core environments that are likely to exist for a long time, I think defaulting to error mode would likely not be achievable, so the "most complete" outcome would be to start ignoring COMPlus_ at some point. |
Yep. I think this makes sense for a .NET 8 or beyond change. |
Not directly related, but I am interested in the thoughts about the question I asked above about which variables are supported.
We have a situation where some are fully supported and some are not supported at all and/or don't work, and it's not clear (even in the code, apparently) which is which. Maybe there are three buckets: (1) fully supported, expected to continue to work, documented in some form, can be used in production (2) not supported but widely used eg for diagnostic purposes and we would likely fix if they broke (3) not supported/may not even work. |
I think it should be: If the setting is documented on http://docs.microsoft.com/, it is supported. Otherwise, it is unsupported. |
That needs auditing, I think. Eg. I picked COMPlus_EnableHWIntrinsic and COMPlus_EnableAVX at random and bing says they're not in docs.microsoft.com. |
On unix platforms at least, env variables are traditionally uppercase, so it might be useful to allow uppercase variants as well. |
We'll also have to be careful to not overload the same variable. The And then there's the already mentioned generic host by @gfoidl. This one is particularly nasty - it takes all environment variables prefixed with |
If we don't (ever) remove the COMPlus_ variables, is there still value to add additional DOTNET_ "mirrors" of the variables? They may look odd, but is it a real problem? What if we only checked for both prefixes for non-DEBUG (i.e., Release build available) variables, and forced all DEBUG variable usage to change to the new form? As a transition concern, I'd be really worried we stop looking for COMPlus_ variables, forget to update some test or testing system, and end up not testing some stress mode that we were previously testing. I'm slightly worried about the overhead of checking for both. The JIT currently eagerly checks for all its variables at startup. fwiw, the JIT uses the same config mechanism, but its variables are in https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/jitconfigvalues.h, not in clrconfigvalues.h. |
For those not aware, it is not obvious that COMPlus_ has anything to do with .NET. If anything it's a Windowsism. |
As a smaller issue, docs sometimes assume that it's case insensitive (as it is on Windows). Eg., in this topic it lists variables like COMPLUS_GCHeapHardLimitSOHPercent which as far as I know won't work on Linux. It may be easier to be consistent with DOTNET. |
Of course, this has been the case for over 2 decades, and I'm not aware that this has ever caused any real problem for .NET customers. At this point, COMPlus_ has more to do with .NET than anything else. ;) |
Right, We have been fixing non-sensical (Windows-specific) names in other places too, for example #46843 (comment) . |
@marklio right, but for someone new to the platform, it cannot be inferred.. |
And I hope to reduce our use of Win32Exception |
We have a lot of configuration possible via environment variables that begin with the prefix "COMPlus", e.g. all of the values in https://github.com/dotnet/runtime/blob/16c48d6a45d4d706c327fc840e1a5d450fb189ae/src/coreclr/inc/clrconfigvalues.h.
This is 20-year old legacy finding its way into user-visible configuration for the platform.
Can we rename this to "DOTNET"?
If there are concerns about tools that have hardcoded "COMPlus", we could support both for a few releases and then delete the "COMPlus" support when the majority of hardcodings have switched over.
The text was updated successfully, but these errors were encountered: