[Bug 12236] New: ash hangs after wait returns EINTR

bugzilla at busybox.net bugzilla at busybox.net
Thu Sep 19 12:51:19 UTC 2019


https://bugs.busybox.net/show_bug.cgi?id=12236

            Bug ID: 12236
           Summary: ash hangs after wait returns EINTR
           Product: Busybox
           Version: 1.31.x
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: martin.brueckner at psi.ch
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

I am running busybox on a NIOS2 Softcore CPU. As shell I am using ash.
With process IDs below 512 everything runs smoothly.
But when it comes to PID 512 ash hangs in an endless loop.
Starting a new ash shell afterwards (PID > 512) works. One has to kill the
first shell with -9. ash in the endless loop keeps the CPU at 100%.

To debug this issue I let ash run with strace.
Additionally I wrote a small program which prints its own and the parent's PID.

# ./pid
My process ID : 495
My parent's ID: 137
# 

Having ash running with strace and starting ./pid gives me this output:

ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
rt_sigaction(SIGWINCH, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, NULL, 8) =
0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=NULL) = 518
setpgid(518, 518)                       = 0
wait4(-1, My process ID : 518
My parent's ID: 517
[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WSTOPPED, NULL) = 518
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=518, si_uid=0,
si_status=0, si_utime=1, si_stime=6} ---
rt_sigreturn({mask=[]})                 = 518
ioctl(10, TIOCSPGRP, [517])             = 0
wait4(-1, 0x7fdadc28, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes)
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost -isig -icanon -echo ...}) =
0


Running ./pid with PID 512 wait4 returns with EINTR and then wait is called
again and again returning ECHILD. ash does not recover from this.

Other shells like bash or zsh seems to handle this differently. They don't hang
at PID 512.


ioctl(0, SNDCTL_TMR_START or TCSETS, {B134 -opost isig icanon echo ...}) = 0
rt_sigaction(SIGWINCH, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, NULL, 8) =
0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=NULL) = 512
setpgid(512, 512)                       = 0
wait4(-1, My process ID : 512
My parent's ID: 143
[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WSTOPPED, NULL) = 512
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=512, si_uid=0,
si_status=0, si_utime=0, si_stime=7} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
wait4(-1, 0x7fc08b98, WSTOPPED, NULL)   = -1 ECHILD (No child processes)
...
(endless loop)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list