gnosek / fcgiwrap

Simple FastCGI wrapper for CGI scripts
http://nginx.localdomain.pl/
MIT License
407 stars 134 forks source link

100 CPU usage after kill child process #18

Closed LastDragon-ru closed 10 years ago

LastDragon-ru commented 10 years ago

OS: CentOS release 6.5 (Final) 2.6.32-431.3.1.el6.i686

fcgiwrap -c 5
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
---------------------------------------------------------------------
 5614 user      20   0  2024  384  324 S  0.0  0.0   0:00.00 fcgiwrap
 5615 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5616 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5617 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5618 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5619 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap

After kill any child (5615-5619)

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
---------------------------------------------------------------------
 5614 user      20   0  2024  384  324 R 99.9  0.0   0:06.42 fcgiwrap  !!!!!
 5615 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5616 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5617 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
 5619 user      20   0  2160  356  284 S  0.0  0.0   0:00.00 fcgiwrap
Lekensteyn commented 10 years ago

Can you attach gdb and show a backtrace? How can this be reproduced?

GDB command would be:

gdb -p 5614 -ex bt
LastDragon-ru commented 10 years ago

How can this be reproduced?

Run fcgiwrap -c 5 and then kill any child (not main) process.

Can you attach gdb and show a backtrace?

#0  0x00722424 in __kernel_vsyscall ()
#1  0x00359483 in __waitpid_nocancel () from /lib/libc.so.6
#2  0x08049048 in sigchld_handler (dummy=<value optimized out>)
    at fcgiwrap.c:626
#3  <signal handler called>
#4  0x00722424 in __kernel_vsyscall ()
#5  0x00359906 in __pause_nocancel () from /lib/libc.so.6
#6  0x08049a5f in prefork (argc=3, argv=0xbfb9d154) at fcgiwrap.c:665
#7  main (argc=3, argv=0xbfb9d154) at fcgiwrap.c:842
Lekensteyn commented 10 years ago

Thanks, reproduced and patch submitted.