posix_spawnp creates ghost processes

Ken Brown kbrown@cornell.edu
Fri Apr 24 12:47:42 GMT 2020


On 4/24/2020 3:30 AM, Kristian Ivarsson via Cygwin wrote:
> Hi all
> 
> We're having a rather complex application and have noticed a rather weird
> behaviour that I cannot find any information about
> 
> We're using posix_spawnp and sometimes it creates extra "ghost-process(es)"
> non visible to cygwin (via e.g. process status (ps)) but visible to Windows
> (Task Manager)
> 
> The function doesn't fail and it doesn't report any error, but sometimes
> (hard to reproduce deterministically) it creates one, or more, extra
> processes of the same binary
> 
> 
> 
> Have anyone noticed and/or have some information/ideas about this ?

Cygwin's posix_spawn uses execve under the hood.  The latter creates a new 
Windows process, does some housekeeping, and then transfers control from the old 
process to the new one.  There will be a short period of time when both 
processes exist from the Windows point of view.

Ken


More information about the Cygwin mailing list