error_log cannot be reopened when kill a USR1 signal

Igor Sysoev is at rambler-co.ru
Fri Oct 9 18:05:27 MSD 2009


On Fri, Oct 09, 2009 at 11:12:12AM +0800, 任晓磊 wrote:

> [root at tupian_web logs]# ls -l /proc/`cat nginx.pid `/fd
> total 15
> lrwx------  1 root root 64 Oct  9 11:08 0 -> /dev/null
> lrwx------  1 root root 64 Oct  9 11:08 1 -> /dev/null
> lrwx------  1 root root 64 Oct  9 11:08 10 -> socket:[52975564]
> lrwx------  1 root root 64 Oct  9 11:08 11 -> socket:[52975565]
> lrwx------  1 root root 64 Oct  9 11:08 12 -> socket:[52975566]
> lrwx------  1 root root 64 Oct  9 11:08 13 -> socket:[52975569]
> lrwx------  1 root root 64 Oct  9 11:08 14 -> socket:[52975570]
> l-wx------  1 root root 64 Oct  9 11:08 2 -> /usr/local/nginx/logs/error.log
> l-wx------  1 root root 64 Oct  9 11:08 3 -> /usr/local/nginx/logs/error.log
> l-wx------  1 root root 64 Oct  9 11:08 4 ->
> /usr/local/nginx/logs/host.access.log
> l-wx------  1 root root 64 Oct  9 11:08 5 -> /usr/local/nginx/logs/error.log
> lrwx------  1 root root 64 Oct  9 11:08 6 -> socket:[52975557]
> lrwx------  1 root root 64 Oct  9 11:08 7 -> socket:[52975560]
> lrwx------  1 root root 64 Oct  9 11:08 8 -> socket:[52975561]
> lrwx------  1 root root 64 Oct  9 11:08 9 -> socket:[52975563]
> [root at tupian_web logs]# mv error.log error.log.1
> [root at tupian_web logs]# mv host.access.log host.access.log.1
> [root at tupian_web logs]# kill -USR1 `cat nginx.pid `
> [root at tupian_web logs]# ls -l
> total 648
> -rw-r--r--  1 nobody root      0 Oct  9 11:08 error.log
> -rw-r--r--  1 root   root    941 Oct  9 11:07 error.log.1
> -rw-r--r--  1 nobody root  14521 Oct  9 11:08 host.access.log
> -rw-r--r--  1 root   root 633729 Oct  9 11:08 host.access.log.1
> -rw-r--r--  1 root   root      6 Oct  9 11:07 nginx.pid
> [root at tupian_web logs]# ls -l /proc/`cat nginx.pid `/fd
> total 15
> lrwx------  1 root root 64 Oct  9 11:08 0 -> /dev/null
> lrwx------  1 root root 64 Oct  9 11:08 1 -> /dev/null
> lrwx------  1 root root 64 Oct  9 11:08 10 -> socket:[52975564]
> lrwx------  1 root root 64 Oct  9 11:08 11 -> socket:[52975565]
> lrwx------  1 root root 64 Oct  9 11:08 12 -> socket:[52975566]
> lrwx------  1 root root 64 Oct  9 11:08 13 -> socket:[52975569]
> lrwx------  1 root root 64 Oct  9 11:08 14 -> socket:[52975570]
> l-wx------  1 root root 64 Oct  9 11:08 15 ->
> /usr/local/nginx/logs/host.access.log
> l-wx------  1 root root 64 Oct  9 11:08 2 -> /usr/local/nginx/logs/error.log
> l-wx------  1 root root 64 Oct  9 11:08 3 -> /usr/local/nginx/logs/error.log.1
> l-wx------  1 root root 64 Oct  9 11:08 4 -> /usr/local/nginx/logs/error.log
> lrwx------  1 root root 64 Oct  9 11:08 6 -> socket:[52975557]
> lrwx------  1 root root 64 Oct  9 11:08 7 -> socket:[52975560]
> lrwx------  1 root root 64 Oct  9 11:08 8 -> socket:[52975561]
> lrwx------  1 root root 64 Oct  9 11:08 9 -> socket:[52975563]
> [root at tupian_web logs]# ../sbin/nginx -V
> nginx version: nginx/0.7.62
> built by gcc 3.4.6 20060404 (Red Hat 3.4.6-8)
> configure arguments:
> 
> After kill a USR1 signal to nginx master process, it keeps opening
> error.log file and error.log.1 file. Why?

The attached patch fixes the bug. The bug had appeared somewhere in 0.7.x,
probably in 0.7.53, however, I'm not sure.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.builin.log.txt
Type: application/octet-stream
Size: 537 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20091009/a3e5dc50/attachment.obj>


More information about the nginx mailing list