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

setpgid() fails with EPERM if pgid is exited but not reaped (it should succeed) #2786

Closed
ridiculousfish opened this issue Dec 24, 2017 · 3 comments
Assignees

Comments

@ridiculousfish
Copy link

ridiculousfish commented Dec 24, 2017

This is a reduced test case for some behavior that we're seeing in the fish shell. One issue in fish, previous WSL issue which was considered fixed but is not.

fish handles pipeline jobs by making the first process the group leader for all processes in the job, via setpgid. However if the group leader has exited (but not yet been reaped), the setpgid() call fails with EPERM on WSL, where AFAICT it ought to succeed (it does on macOS and Linux).

Tested on Win10 build 16299.rs3_release.170928-1534.

To reproduce: compile and run run.c as cc run.c; ./a.out On WSL this will output some errors and hang. On macOS and Linux it succeeds.

You can simulate fish's ugly workaround by running ./a.out keepalive. This keeps the parent process alive until the child has joined it, which prevents the error.

@therealkenc
Copy link
Collaborator

therealkenc commented Dec 25, 2017

I call this the Rick Grimes problem. Like #1353 (message). From ps on Real Linux:

11006 pts/0    S+     0:00 ./a.out
11007 pts/0    Z      0:00 [a.out] <defunct>

On WSL, zombies die right away.

@ridiculousfish
Copy link
Author

21niaq

@Brian-Perkins
Copy link

This should work better starting in Insider Build 17713

mqudsi added a commit to mqudsi/fish-shell that referenced this issue Sep 30, 2018
MSFT addressed this in Windows 10 build 17713, but that's not included
in any public releases yet, so keep that around for a little while
longer.

ref microsoft/WSL#2786
ref microsoft/WSL#1353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants