[fpc-pascal] TProcess and zombie processes in *nix systems

2020-01-21 Thread Graeme Geldenhuys
Hi,

In fgGUI applications I often launch other applications. eg: The help
viewer etc. In such cases, I simply want to launch the application and
then forget about it. I have no need to read any stdout etc.

I've been using TProcess for this task as follows:

  p := TProcess.Create(nil);
  try
p.Executable := ...
p.Execute;
  finally
p.free
  end;

As TProcess is a TComponent descendant, I specify nil as the Owner, thus
I manually free it. It was brought to my attention that if the user has
a long running application (eg: an RSS feed reader - lunching a web
browser via TProcess), after a while they have many Zombie processes in
Linux hanging around until the fpGUI application terminates.

Two things:

  1.  The way I create the TProcess. Why or how does it have
  a dependency on the fpGUI application?

  2.  Anybody else experience this zombie processes hanging
  around in *nix systems? Is there any option in TProcess
  to prevent that?

ie: I want to launch a new application in a separate OS process and then
forget about it.


Regards,
  Graeme
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TProcess and zombie processes in *nix systems

2020-01-21 Thread Marco van de Voort


Op 2020-01-21 om 21:40 schreef Graeme Geldenhuys:
  
ie: I want to launch a new application in a separate OS process and then

forget about it.


This is the responsibility of the callee I think, to daemonize and cut 
the cord so to speak.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TProcess and zombie processes in *nix systems

2020-01-21 Thread Bart via fpc-pascal
On Tue, Jan 21, 2020 at 9:41 PM Graeme Geldenhuys
 wrote:

>   2.  Anybody else experience this zombie processes hanging
>   around in *nix systems? Is there any option in TProcess
>   to prevent that?

https://bugs.freepascal.org/view.php?id=11797

-- 
Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TProcess and zombie processes in *nix systems

2020-01-21 Thread Sven Barth via fpc-pascal

Am 21.01.2020 um 22:04 schrieb Marco van de Voort:


Op 2020-01-21 om 21:40 schreef Graeme Geldenhuys:
  ie: I want to launch a new application in a separate OS process and 
then

forget about it.


This is the responsibility of the callee I think, to daemonize and cut 
the cord so to speak.
Indeed, doesn't seem to be that easy: 
https://stackoverflow.com/questions/27361227/how-to-prevent-creation-of-zombie-processes-while-using-fork-and-exec-in-lin


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal