public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* posix_spawnp creates ghost processes
@ 2020-04-24  7:30 sten.kristian.ivarsson
  2020-04-24  8:10 ` Andrey Repin
  2020-04-24 12:47 ` Ken Brown
  0 siblings, 2 replies; 4+ messages in thread
From: sten.kristian.ivarsson @ 2020-04-24  7:30 UTC (permalink / raw)
  To: cygwin

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 ?



Kristian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: posix_spawnp creates ghost processes
  2020-04-24  7:30 posix_spawnp creates ghost processes sten.kristian.ivarsson
@ 2020-04-24  8:10 ` Andrey Repin
  2020-04-24 13:18   ` Sv: " sten.kristian.ivarsson
  2020-04-24 12:47 ` Ken Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Andrey Repin @ 2020-04-24  8:10 UTC (permalink / raw)
  To: Kristian Ivarsson via Cygwin, cygwin

Greetings, Kristian Ivarsson via Cygwin!

> 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)

Cygwin may spawn processes for housekeeping. F.e. if you "program &" in shell,
an additional shell will be spawned to launch the "program" and notify the
parent shell when it exits.

> 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 ?

Are these processes correctly exit when all childs exit?


-- 
With best regards,
Andrey Repin
Friday, April 24, 2020 11:08:35

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: posix_spawnp creates ghost processes
  2020-04-24  7:30 posix_spawnp creates ghost processes sten.kristian.ivarsson
  2020-04-24  8:10 ` Andrey Repin
@ 2020-04-24 12:47 ` Ken Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Ken Brown @ 2020-04-24 12:47 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Sv: posix_spawnp creates ghost processes
  2020-04-24  8:10 ` Andrey Repin
@ 2020-04-24 13:18   ` sten.kristian.ivarsson
  0 siblings, 0 replies; 4+ messages in thread
From: sten.kristian.ivarsson @ 2020-04-24 13:18 UTC (permalink / raw)
  To: cygwin

> Greetings, Kristian Ivarsson via Cygwin!
> 
> > 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)
> 
> Cygwin may spawn processes for housekeeping. F.e. if you "program &" in
> shell, an additional shell will be spawned to launch the "program" and
> notify the parent shell when it exits.
> 
> > 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 ?
> 
> Are these processes correctly exit when all childs exit?

Well, no

The issue is that due to some other issue, the main program hangs in some
kind of blocking mode (don't know why yet)

I exit that with SIGINT (via console and Ctrl+C) and there are a few
processes running that were created by posix_spawnp according to the CygWin
TTY, but according to Windows, some of the processes are duplicated
processes

If I kill -9 them in CygWin, the ones not visible are still running
according to Windows Task Manager

> --
> With best regards,
> Andrey Repin
> Friday, April 24, 2020 11:08:35
> 
> Sorry for my terrible english...



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-24 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24  7:30 posix_spawnp creates ghost processes sten.kristian.ivarsson
2020-04-24  8:10 ` Andrey Repin
2020-04-24 13:18   ` Sv: " sten.kristian.ivarsson
2020-04-24 12:47 ` Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).