Repository navigation
[cDAC] Handle GettingReJITParameters state - #135471
Conversation
While ReJIT parameter configuration is in progress, an IL code version's state is RejitFlags::kStateGettingReJITParameters (1). The ReJIT contract knew only kStateRequested (0) and kStateActive (2) and threw InvalidOperationException for it, so every SOS and DBI query that read the state of such a version failed. The legacy DAC handles it: GetReJITInformation reports DacpReJitData2::kUnknown and GetPendingReJITID returns S_FALSE. - Add RejitState.GettingReJITParameters and map the native value. - The two SOS flag conversions report it as kUnknown, as the legacy DAC does. The other callers compare against Requested or Active and now behave as the legacy DAC does for this state instead of failing. - Replace the no-op Debug.Assert(true, ...) on the unknown-state path with Debug.Fail. - Mark the value in codeversion.h as one the contract depends on. - Update ReJIT.md.
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
I'd suggest returning runtime/src/coreclr/vm/rejit.cpp Line 1064 in cff49ad |
|
Thanks, One question on scope before I change it: should only state 1 map to A small note on the window: the state is set at L971 on every ReJIT, not only when threads race. It holds for the whole |
I would suggest mapping any unknown state to |
Per review, replace RejitState.GettingReJITParameters with RejitState.Unknown, and map every state value the contract does not recognize to it instead of throwing. State 1 (kStateGettingReJITParameters) is one such value. New runtime states report Unknown until there is a reason to expose them. - The SOS flag conversions report Unknown as kUnknown, as the legacy DAC does for any state other than Requested and Active. - Drop kStateGettingReJITParameters from the contract's RejitFlags and its contract-dependency comment from codeversion.h. - ReJIT.md states the rule. - Tests: state-nibble values other than Requested and Active, with and without flag bits, now expect Unknown. The SOS theories add the unrecognized values 3 and 15.
|
Thanks, done in f66c547. |
Remove the comments on RejitState.Unknown and on its cases in SOSDacImpl. Reduce the new tests to one contract theory and one SOS check that an unrecognized state reports Unknown without throwing. CopyNativeCodeVersionToReJitData is private again, since no test calls it directly.
|
/ba-g unrelated stress fails |
|
@rcj1: thanks for the review and for merging it. |
While ReJIT parameter configuration is in progress, an IL code version's state is
RejitFlags::kStateGettingReJITParameters(1); one example is while the profiler'sGetReJITParameterscallback runs. The ReJIT contract knew onlykStateRequested(0) andkStateActive(2), and threwInvalidOperationExceptionfor state 1. So every SOS or DBI query that reads the state of such a version failed when a dump or live attach caught a method mid-ReJIT.The legacy DAC handles the state. Its two flag switches report
kUnknownfor any state other than Requested and Active; in a Debug DAC they_ASSERTEfirst. Its comparisons treat the state as "not Requested, not Active".Changes:
RejitState.Unknown. The contract maps every state value it does not recognize to it, state 1 included, instead of throwing. New runtime states reportUnknownuntil there is a reason to expose them.UnknownaskUnknown:GetReJITInformation, andCopyNativeCodeVersionToReJitDatabehindGetMethodDescData.RequestedorActive. For anUnknownversion they now behave as the legacy DAC does, instead of failing:GetPendingReJITIDreturnsS_FALSE;GetRejitIdsskips the version;GetProfilerModifiedILInformationandGetMethodsWithProfilerModifiedILtreat the version as ReJIT-modified;GetActiveRejitILCodeVersionNodereports no active node.Debug.Assert(true, ...)on the unhandled-state path ofGetReJITInformationbecomesDebug.Fail.ReJIT.md, including the rule that unrecognized values areUnknown.Tests:
GetRejitStatereturnsUnknown, without throwing, for state 1 and for the undefined value 3.GetReJITInformationsucceeds and reportskUnknownfor a state-1 version.Unknownarm ofGetRejitStateput back to the original throw, all 12 rows of these two tests fail and nothing else does.CdacUsageGraph docs --checkand Usage.Tests pass. The first revision also ran on osx-arm64 and windows-x64.Noticed, not changed here: on
S_FALSEthe legacyGetPendingReJITIDsets*pRejitIdto -1, and the cDAC leaves it untouched.Note
This PR was prepared with AI assistance (Anthropic Claude, reviewed with OpenAI Codex). The tests and validation runs were executed locally.