[vs18.3] Fix the lifecycle of task host factory#13022
Conversation
|
@copilot please add a test to validate this scenario |
|
@ViktorHofer I've opened a new pull request, #13023, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where tasks with Runtime=NET were incorrectly using long-lived task hosts (with node reuse) even when the task host factory was explicitly requested. The fix ensures that explicitly requested task host factories always use short-lived task hosts, allowing DLLs to be released after build completion.
Changes:
- Removed the
|| isNetRuntimecondition from theuseSidecarTaskHostlogic, ensuring TaskHostFactoryExplicitlyRequested takes precedence - Added clear inline comments explaining when sidecar task hosts should and should not be used
|
could you please publish a matrix or document it somewhere when we expect to have a short/long lived processes? |
If the task host factory is explicitly requested, do not act as a long lived task host. This is important as customers use task host factories for short lived tasks to release potential locks after the build. This goes back to the previous behavior. This regressed with #12620
bf4a7e9 to
63306eb
Compare
|
@YuliiaKovalova I just asked copilot to make sure we have a test that explicitly covers the matrix in the linked test-creation PR, so that should handle your request too :) |
|
I just added a table to our own documentation. Thanks for the suggestion @YuliiaKovalova |
Ok, it looks like it will be long-lived only for But here it's short-lived is it correct? |
|
It's quite easy. Whenever you specify |
|
OK I see a weird behavior for .NET Framework msbuild.exe launching a TaskFactory="TaskHostFactory" && Runtime="NET" task. I would be surprised if that's expected as we discussed that TaskHostFactory should always be short-lived. I need to find out why that's the case in the product code. |
|
OK @YuliiaKovalova explained to me that this is happening because we don't respect the nodeReuse setting here: We might want to fix this in 10.0.1xx as well as it would impact TaskHostFactory there as well. In the when there's already a long running task host running in the process tree. |
If the task host factory is explicitly requested, do not act as a long lived task host. This is important as customers use task host factories for short lived tasks to release potential locks after the build.
This goes back to the previous behavior.
This partially regressed with #12620
Fixes #13013