GNOME Bugzilla – Bug 761299
[review, openvpn] properly handle child/openvpn processes [th/handle-child-process-bgo761299]
Last modified: 2016-02-02 17:09:14 UTC
please review
LGTM except for the g_usleep (1). That wouldn't give a child process a lot of time to clean itself up?
(In reply to Dan Williams from comment #1) > LGTM except for the g_usleep (1). That wouldn't give a child process a lot > of time to clean itself up? yeah... it's not clear what to do in this case... maybe only send SIGKILL to the still alive process and not SIGKILL at all? Best would be that the process sticks around until we all child processes terminate (and still properly send SIGKILL after the 2 seconds timeout).
how about v2? Now, we still send only SIGTERM in the dispose of the service instance, but wait before shutdown until all child processes properly terminated.
> service: fix handling child processes and their cleanup + pid_data->watch_id = 0; + gl.pids_pending_list = g_slist_remove (gl.pids_pending_list , pid_data); + pids_pending_data_free (pid_data); The first line can be dropped since pids_pending_data_free() already does that. /* OpenVPN doesn't supply useful exit codes :( */ - if (error == 0) + if (WIFEXITED (status) && WEXITSTATUS (status) == 0) extra space. + g_message ("openvpn[%ld] exited with success", (long) pid); + } + else if (WIFSTOPPED (status)) Indentation of '}'. The rest LGTM.
(In reply to Beniamino Galvani from comment #4) > > service: fix handling child processes and their cleanup > > + pid_data->watch_id = 0; > + gl.pids_pending_list = g_slist_remove (gl.pids_pending_list , > pid_data); > + pids_pending_data_free (pid_data); I think watch_id should be explicitly set to zero to prevent pids_pending_data_free() calling g_source_remove on it. So this seems right. > The first line can be dropped since pids_pending_data_free() already > does that. > > /* OpenVPN doesn't supply useful exit codes :( */ > - if (error == 0) > + if (WIFEXITED (status) && WEXITSTATUS (status) == 0) > > extra space. > > + g_message ("openvpn[%ld] exited with success", (long) pid); > + } > + else if (WIFSTOPPED (status)) > > Indentation of '}'. Fixed Thanks
merged to master: https://git.gnome.org/browse/network-manager-openvpn/commit/?id=25ed57678db82b8d268021712e75dc9988428e27