cef_launch_process leaves zombie process

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

cef_launch_process leaves zombie process

Postby king » Fri Sep 20, 2019 12:36 am

Hi All
I am using cef_launch_process to launch my own process to open some file downloaded, it all works well and the targeted process could be launched, However when my process exited normally, I found zombie process left via top commandline.
Is this a bug or am I missing something?
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: cef_launch_process leaves zombie process

Postby king » Fri Sep 20, 2019 1:50 am

according to the source code here:https://chromium.googlesource.com/chromium/src/base/+/master/process/launch_posix.cc:491
since the options.wait is by default false, it seems that cef will never wait on the child process launched, hence causing this zombie child process. any explanation on this??
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: cef_launch_process leaves zombie process

Postby magreenblatt » Fri Sep 20, 2019 4:33 am

The process that you launch should terminate itself when its work is done. If needed it can also monitor if the parent process has died, for example using this approach.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef_launch_process leaves zombie process

Postby king » Fri Sep 20, 2019 4:39 am

magreenblatt wrote:The process that you launch should terminate itself when its work is done. If needed it can also monitor if the parent process has died, for example using this approach.

the process cef launched is third party and i cannot modify its code to monitor parent process. and it terminated normally when work is done. The problem here is that the parent process(cef process) does not waitpid on child process which causes the zombie process when the child process exited normally. I wonder why cef does not waitpid on its child process??
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: cef_launch_process leaves zombie process

Postby magreenblatt » Fri Sep 20, 2019 5:12 am

Which process is the zombie process? If it's the third-party process (which should exit itself), then that sounds like expected behavior.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef_launch_process leaves zombie process

Postby king » Sun Sep 22, 2019 8:43 pm

magreenblatt wrote:Which process is the zombie process? If it's the third-party process (which should exit itself), then that sounds like expected behavior.

Yes it is the third party process, why is this expected behavior? isn't that problematic??
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: cef_launch_process leaves zombie process

Postby magreenblatt » Mon Sep 23, 2019 4:28 am

As described above, the expected behavior is that the third-party process will terminate itself when no longer required. If that's not the behavior you want then you will need to write your own code for launching or terminating the third-party process.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef_launch_process leaves zombie process

Postby magreenblatt » Mon Sep 23, 2019 4:32 am

king wrote:according to the source code here:https://chromium.googlesource.com/chromium/src/base/+/master/process/launch_posix.cc:491
since the options.wait is by default false, it seems that cef will never wait on the child process launched, hence causing this zombie child process. any explanation on this??

This option would block parent process execution until the child process terminates. From the above conversation it sounds like you instead want to terminate the child process when the parent process exits.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: cef_launch_process leaves zombie process

Postby king » Mon Sep 23, 2019 4:33 am

magreenblatt wrote:As described above, the expected behavior is that the third-party process will terminate itself when no longer required. If that's not the behavior you want then you will need to write your own code for launching or terminating the third-party process.

Sorry for not making the problem clear here, the child process does terminate itself normally, the problem is that its parent does not wait on the exit of the child process which causes the zombie process.
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: cef_launch_process leaves zombie process

Postby magreenblatt » Mon Sep 23, 2019 4:36 am

king wrote:
magreenblatt wrote:As described above, the expected behavior is that the third-party process will terminate itself when no longer required. If that's not the behavior you want then you will need to write your own code for launching or terminating the third-party process.

Sorry for not making the problem clear here, the child process does terminate itself normally, the problem is that its parent does not wait on the exit of the child process which causes the zombie process.

It's possible that I'm misunderstanding some Linux OS detail here. If the child process will terminate itself normally, why does it matter if the parent process is still alive at that time?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 42 guests