[release/9.0-staging] Don't use vfork on android #118331
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #118085 to release/9.0-staging
When we start the child process, we clear all signal handlers. When using vfork, on Android, this operation ends up clearing the signal handlers also for the parent process. Revert to just using fork for simplicity.
vfork usage was added back in dotnet/corefx#33289, seems like there were some potential concerns then.
Legacy Xamarin was using fork.
Fixes #97209.
Customer Impact
Using
System.Diagnostics.Process.Start
breaks the signal handlers of the runtime. This api can also be used as part of some BCL functionality, for exampleSystem.Net.NetworkingInformation.Ping
. One of the side effects of this is that NRE is no longer thrown when dereferencing a null pointer. This essentially means that the runtime is completely broken after usingProcess.Start
. This impacts users migrating from legacy Xamarin to MAUI.Regression
Regression compared to legacy Xamarin. It was always broken on MAUI however.
Testing
Tested locally with sample application.
Risk
Low. This commit simply reverts to using
fork
instead ofvfork
on android. This was the default on Xamarin. Whilefork
is less optimized (it might make the process start a few milliseconds slower and use more memory), it is not used heavily in MAUI. This also won't impact users, because customers usingProcess.Start
before would run into other completely breaking issues anyway.