View Issue Details

IDProjectCategoryView StatusLast Update
0035527LazarusLazUtilspublic2020-09-17 21:56
ReporterFedon Kadifeli Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformGNOMEOSUbuntu 
Product Version2.1 (SVN) 
Summary0035527: openDocument and openURL leave zombie processes
DescriptionEach time I call openDocument to open a file or openURL to open a web address in the default browser, I see accumulating defunct processes. The parent process of these is my calling program. The underlying code of these procedures should wait for xdg-open process to return.

Recommended patch:

To solve this, I added the following line to file components/lazutils/utf8process.pp, line 234 (at procedure RunCmdFromPath):

    BrowserProcess.Options := BrowserProcess.Options + [poWaitOnExit];
Steps To ReproduceRun a code like this in a Lazarus program:

OpenDocument('/home/me/Documents/text.txt');

Gedit will open. Without closing the calling Lazarus program, run the following bash command

ps -ef | grep -i defunct

A defunct process (child of the Lazarus program) will appear.
Additional InformationDiscussed in https://forum.lazarus.freepascal.org/index.php?topic=45271
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetGTK 2
Attached Files

Relationships

related to 0011797 closedJonas Maebe FPC Starting something via TProcess and then closing it leaves a zombie process 

Activities

Fedon Kadifeli

2020-04-26 15:50

reporter   ~0122451

I just wanted to inform you that this problem still persists in Lazarus 2.0.8 too.

jamie philbrook

2020-04-26 18:52

reporter   ~0122454

Its best if not yet implemented to simply return a handle that can be used in your app so that it can be tracked and close from your app's end...
 
 I use OpenUrl and I don't want it hanging there holding up the process.

 I guess the other option is to have a variant of it with a user request to lock the other processes while up.

Fedon Kadifeli

2020-09-17 18:34

reporter   ~0125595

To solve this, I suggest the following line to be added to file components/lazutils/utf8process.pp, line 234 (at procedure RunCmdFromPath):

    BrowserProcess.Options := BrowserProcess.Options + [poWaitOnExit];

Issue History

Date Modified Username Field Change
2019-05-06 10:08 Fedon Kadifeli New Issue
2020-04-26 15:50 Fedon Kadifeli Note Added: 0122451
2020-04-26 18:52 jamie philbrook Note Added: 0122454
2020-09-17 18:34 Fedon Kadifeli Note Added: 0125595
2020-09-17 21:56 Bart Broersma Relationship added related to 0011797