Skip to content

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

Closed

Description

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.

Activity

  1. therealkenc commented on Dec 25, 2017

    @therealkenc

    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.

  2. ridiculousfish commented on Dec 25, 2017

    @ridiculousfish
    Author

    21niaq

  3. Brian-Perkins commented on Jul 11, 2018

    @Brian-Perkins
    Contributor

    This should work better starting in Insider Build 17713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions