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

Scheduler should honor BuildParameters.DisableInprocNode #6400

Merged
merged 6 commits into from Jun 4, 2021

Conversation

cdmihai
Copy link
Contributor

@cdmihai cdmihai commented May 1, 2021

Context

There are two ways in MSBuild to disable the inproc node:

  • via the environment variable MSBuildNoInprocNode
  • by setting BuildParameters.DisableInprocNode

The implementations of these two, as you'd expect from MSBuild, are totally separate, they have nothing in common. The env var informs the Scheduler to assign all requests to out of proc nodes, regardless of their affinities. And the build parameter informs the NodeManager to just bail out on inproc node creation and return null.

This means that if you set the env var and build a traversal project (dirs.proj, or a solution metaproj file), then all is fine, the scheduler silently redirects them to out of proc nodes. But if you set the build parameter instead of the env var and build the traversal dirs.proj then MSBuild fails with: MSBUILD : error MSB4223: A node of the required type InProc could not be created.

This is causing #6386 to fail some unit tests which ensure that the project cache plugin can function with the inproc node disabled: https://dev.azure.com/dnceng/public/_build/results?buildId=1114344&view=ms.vss-test-web.build-test-results-tab&runId=33953534&resultId=101506&paneView=debug

This is a bit inconsistent and I just don't see the reason for having two separate things. So I made BuildParamters.DisableInProcNode also trigger the Scheduler's ForceAffinityOutOfProc. I doubt it would break anybody, and would actually benefit the users that want to both disable the inproc node via the API (like VS does in certain cases) and avoid node creation exceptions.

Changes Made

The scheduler now forces affinity to out of proc when either the env var is set, or the build parameter is set. It will avoid build failures when the build parameter is set.

Testing

Added / updated unit tests.

@ladipro
Copy link
Member

ladipro commented May 5, 2021

The change looks good, although technically it is breaking so wondering if it shouldn't be behind a changewave.

Also, this is another place where we check the env var only:

return _host.BuildParameters.MaxNodeCount > 1 || s_onlyUseOutOfProcNodes;

Would it make sense to fix it also?

@cdmihai
Copy link
Contributor Author

cdmihai commented May 5, 2021

@ladipro
Which change wave should it be under?

@ladipro
Copy link
Member

ladipro commented May 5, 2021

Which change wave should it be under?

Wave17_0 unless you are intending to backport to 16.x. The main branch is now targeting VS 17.0.

@cdmihai cdmihai added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label May 7, 2021
Copy link
Contributor

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

I suppose cleaning of

// TODO: remove this branch when the DisableInProcNode failure is fixed by https://github.com/dotnet/msbuild/pull/6400
and similar would be done in another PR, am I right?

@cdmihai
Copy link
Contributor Author

cdmihai commented Jun 2, 2021

I suppose cleaning of

// TODO: remove this branch when the DisableInProcNode failure is fixed by https://github.com/dotnet/msbuild/pull/6400

and similar would be done in another PR, am I right?

Yes, future PR after this one gets merged in.

Otherwise the NodeManager disables the inproc node but the schedulre assigns to it which leads to build failures.
@cdmihai cdmihai force-pushed the consistentDisableInprocNode branch from c12f1ce to 56f438f Compare June 2, 2021 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changewave17.0 changewaves merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants