Polkitd: The utils_spawn_data_free reap timeout subprocess did not work resulting in a large number of zombie processes
Submitted by lin..@..ud.com
Assigned to David Zeuthen @david
Link to original bug (#106021)
Description
Hi,
We found a prolem of polkitd.
When run subprocess timeout in rules ,the utils_spawn_data_free reap timeout subprocess did not work , and it result in a large number of zombie processes
It can be reproduced in fedora27. And the upstream has not fix it.
How to reproduce:
-
Add a debug rule , this rule waill run spawn process over 10s and result in a timeout [root@localhost ~]# cat /etc/polkit-1/rules.d/01-test.rules
polkit.addRule(function(action, subject) {
polkit.log("debug start")
try {
polkit.spawn(["/usr/bin/sleep", "15"]);
} catch (error) {
// polkit.log(error)
}
}); -
have a look at the prcess of polkitd, [root@localhost ~]# ps -ef |grep polkit |grep -v polkit polkitd 1501 1 0 Mar31 ? 00:02:51 /usr/lib/polkit-1/polkitd --no-debug polkitd 5060 1501 0 12:37 ? 00:00:00 [sleep]
<defunct>
polkitd 5367 1501 0 12:38 ? 00:00:00 [sleep]<defunct>
polkitd 5631 1501 0 12:38 ? 00:00:00 [sleep]<defunct>
polkitd 5915 1501 0 12:38 ? 00:00:00 [sleep]<defunct>
polkitd 14052 1501 0 12:42 ? 00:00:00 sleep 20
[root@localhost ~]# journalctl -fu polkit -- Logs begin at Sat 2018-03-31 14:36:03 CST. -- Apr 03 12:39:11 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24) Apr 03 12:39:21 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24) Apr 03 12:40:11 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24) Apr 03 12:40:21 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24)