Question regarding runsvdir not reaping children.

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 26 19:37:22 UTC 2017


On Tue, Dec 26, 2017 at 6:09 AM, Markus Gothe <nietzsche at lysator.liu.se> wrote:
> Yes, I saw that but for some reason if you kill it that code will never be invoked and hence the children will become zombies.

I do see it happening.
Here I made one of runsv's to exit via "sv exit /var/service/something":

20:35:12.274316 nanosleep({tv_sec=5, tv_nsec=0}, {tv_sec=1,
tv_nsec=660388676}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
20:35:15.614150 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED,
si_pid=518, si_uid=0, si_status=0, si_utime=1, si_stime=2} ---
20:35:15.614199 restart_syscall(<... resuming interrupted nanosleep ...>) = 0
20:35:17.274544 wait4(-1, NULL, WNOHANG, NULL) = 518
20:35:17.274640 wait4(-1, NULL, WNOHANG, NULL) = 0


> On 25 Dec 2017, at 22:13 , Denys Vlasenko <vda.linux at googlemail.com> wrote:
>
>> On Fri, Dec 22, 2017 at 9:48 PM, Markus Gothe <nietzsche at lysator.liu.se> wrote:
>>> What is the rationale behind not reaping the children when the program
>>> exists? i run it from inittab as a respawn process and I get zombies when
>>> killing it when not reaping children alas the fix was pretty simple.
>>
>> runsvdir does read any children:
>>
>>        for (;;) {
>>                unsigned now;
>>                unsigned sig;
>>
>>                /* collect children */
>>                for (;;) {
>>                        pid_t pid = wait_any_nohang(NULL);
>>                        if (pid <= 0)
>>                                break;
>>                        for (i = 0; i < svnum; i++) {
>>                                if (pid == sv[i].pid) {
>>                                        /* runsv has died */
>>                                        sv[i].pid = 0;
>>                                        need_rescan = 1;
>>                                }
>>                        }
>>                }
>
> //Markus - The panama-hat hacker
>


More information about the busybox mailing list