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

.NET 7 - Process terminated. Error while reaping child. errno = 10 #79540

Closed
JaroslavMajera opened this issue Dec 12, 2022 · 3 comments · Fixed by #79817
Closed

.NET 7 - Process terminated. Error while reaping child. errno = 10 #79540

JaroslavMajera opened this issue Dec 12, 2022 · 3 comments · Fixed by #79817

Comments

@JaroslavMajera
Copy link

JaroslavMajera commented Dec 12, 2022

Description

Hello. We have a cloud docker microservice which runs headless chromium in process. When we switch to .NET 7 we have encountered Process terminated. Error while reaping child. errno = 10 during killing chromium process. We cannot reproduce this behavior with .NET 6. I have prepared repro https://github.com/JaroslavMajera/DotNetReaper.

Thanks

Reproduction Steps

  1. Prepare Dockerfile which periodically runs chromium or maybe something else which spawns child processes.
  2. Start chromium process
  3. Call Process.Kill a Process.WaitForExit()
  4. Repeat

Source code: DotNetReaper-main.zip

Expected behavior

No Exception and chromium is successfully killed

Actual behavior

Sometimes we get

Process terminated. Error while reaping child. errno = 10 at System.Environment.FailFast(System.String) at System.Diagnostics.ProcessWaitState.TryReapChild(Boolean) at System.Diagnostics.ProcessWaitState.CheckChildren(Boolean, Boolean) at System.Diagnostics.Process.OnSigChild(Int32, Int32)

Regression?

Cannot reproduce on .NET 6

Known Workarounds

No response

Configuration

  • .NET 7
  • Docker image mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim
  • Chromium 108

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 12, 2022
@ghost
Copy link

ghost commented Dec 12, 2022

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Hello. We have a cloud docker microservice which runs headless chromium in process. When we switch to .NET 7 we have encountered Process terminated. Error while reaping child. errno = 10 during killing chromium process. We cannot reproduce this behavior with .NET 6. I have prepared repro https://github.com/JaroslavMajera/DotNetReaper.

Thanks

Reproduction Steps

  1. Prepare Dockerfile which periodically runs chromium or maybe something else which spawn child processes.
  2. Start chromium process
  3. Call Process.Kill a Process.WaitForExit()
  4. Repeat

Source code: DotNetReaper-main.zip

Expected behavior

No Exception and chromium is successfully killed

Actual behavior

Sometimes we get

Process terminated. Error while reaping child. errno = 10 at System.Environment.FailFast(System.String) at System.Diagnostics.ProcessWaitState.TryReapChild(Boolean) at System.Diagnostics.ProcessWaitState.CheckChildren(Boolean, Boolean) at System.Diagnostics.Process.OnSigChild(Int32, Int32)

Regression?

Cannot reproduce on .NET 6

Known Workarounds

No response

Configuration

  • .NET 7
  • Docker image mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim
  • Chromium 108

Other information

No response

Author: JaroslavMajera
Assignees: -
Labels:

area-System.Diagnostics.Process

Milestone: -

@adamsitnik
Copy link
Member

@tmds is there any chance you could take a look?

@tmds
Copy link
Member

tmds commented Dec 16, 2022

I haven't run the reproducer yet, but I think it's a regression caused by #65061.

When the dotnet process runs as pid 1, it will reap also processes that are not direct children here:

if (reapAll)
{
do
{
pid = Interop.Sys.WaitPidExitedNoHang(-1, out _);
} while (pid > 0);
}

Inadvertently, we're also reaping direct children, which then leads to the FailFast.

If you change your ENTRYPOINT so dotnet is no longer pid 1, the issue should disappear. Something like:

ENTRYPOINT ["/bin/sh", "-c", "dotnet DotNetReaper.dll"]

I'll work on a fix next week.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 19, 2022
@adamsitnik adamsitnik added regression-from-last-release and removed untriaged New issue has not been triaged by the area owner labels Dec 23, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 23, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jan 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants