mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 07:38:20 +02:00
core/dhcp: kill external dhcp process using nm_utils_kill_process_sync()
nm_utils_kill_child_sync() is not able to reap the external process. This causes NM to hang for 500 ms and logs the following error: <debug> [1412167360.400201] [NetworkManagerUtils.c:534] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): waiting up to 500 milliseconds for process to terminate normally afte <debug> [1412167360.900298] [NetworkManagerUtils.c:549] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): sending SIGKILL... <error> [1412167360.900369] [NetworkManagerUtils.c:576] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): after sending SIGTERM (15) and SIGKILL, waitpid failed with No child Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
efd8be04f1
commit
5bbd8750c7
1 changed files with 6 additions and 2 deletions
|
|
@ -544,11 +544,14 @@ nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name)
|
|||
errno = 0;
|
||||
tmp = strtol (pid_contents, NULL, 10);
|
||||
if ((errno == 0) && (tmp > 1)) {
|
||||
guint64 start_time;
|
||||
const char *exe;
|
||||
|
||||
/* Ensure the process is a DHCP client */
|
||||
start_time = nm_utils_get_start_time_for_pid (tmp);
|
||||
proc_path = g_strdup_printf ("/proc/%ld/cmdline", tmp);
|
||||
if (g_file_get_contents (proc_path, &proc_contents, NULL, NULL)) {
|
||||
if ( start_time
|
||||
&& g_file_get_contents (proc_path, &proc_contents, NULL, NULL)) {
|
||||
exe = strrchr (proc_contents, '/');
|
||||
if (exe)
|
||||
exe++;
|
||||
|
|
@ -556,7 +559,8 @@ nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name)
|
|||
exe = proc_contents;
|
||||
|
||||
if (!strcmp (exe, binary_name))
|
||||
nm_dhcp_client_stop_pid ((pid_t) tmp, NULL);
|
||||
nm_utils_kill_process_sync (tmp, start_time, SIGTERM, LOGD_DHCP,
|
||||
"dhcp-client", 1000 / 2, 1000 / 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue