[[email protected]_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]
[[email protected]_web logs]# mv error.log error.log.1
[[email protected]_web logs]# mv host.access.log host.access.log.1
[[email protected]_web logs]# kill -USR1 cat nginx.pid
[[email protected]_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
[[email protected]_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]
[[email protected]_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?
Hello!
On Fri, Oct 09, 2009 at 11:12:12AM +0800, 任晓磊 wrote:
[…]
l-wx------ 1 root root 64 Oct 9 11:08 3 -> /usr/local/nginx/logs/error.log.1
After kill a USR1 signal to nginx master process, it keeps opening
error.log file and error.log.1 file. Why?
Looks like a bug, thanks. I’ll take a look how to fix this
properly.
Maxim D.
On Fri, Oct 09, 2009 at 11:12:12AM +0800, 任晓磊 wrote:
l-wx------ 1 root root 64 Oct 9 11:08 3 -> /usr/local/nginx/logs/error.log
[[email protected]_web logs]# ls -l
lrwx------ 1 root root 64 Oct 9 11:08 10 -> socket:[52975564]
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]
[[email protected]_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.
On Fri, Oct 09, 2009 at 02:56:38PM +0400, Maxim D. wrote:
lrwx------ 1 root root 64 Oct 9 11:08 12 -> socket:[52975566]
lrwx------ 1 root root 64 Oct 9 11:08 9 -> socket:[52975563]
[[email protected]_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?
Looks like a bug, thanks. I’ll take a look how to fix this
properly.
Yes, this is a bug, and it is due to nginx open several copies of
error.log.
I’m resolving this now.
2009/10/9 Igor S. [email protected]:
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.
Thank you for resolving it so quickly !
Sorry, it now keeps two error.log
2009/10/10 任晓磊 [email protected]:
On Sat, Oct 10, 2009 at 09:44:09AM +0800, 任晓磊 wrote:
After patched, nginx would not keep error.log.1 open, but still keep
three error.log open.
Should it work this way?
nginx should keep open two error.log files, one of them is stderr
redirection, and its files descriptor number is always 2:
l-wx------ 1 root root 64 Oct 9 11:08 2 ->
/usr/local/nginx/logs/error.log
Could you post the current open files state ?
After patched, nginx would not keep error.log.1 open, but still keep
three error.log open.
Should it work this way?
2009/10/9 Igor S. [email protected]:
2009/10/10 Igor S. [email protected]:
nginx should keep open two error.log files, one of them is stderr
redirection, and its files descriptor number is always 2:
l-wx------  1 root root 64 Oct  9 11:08 2 -> /usr/local/nginx/logs/error.log
Could you post the current open files state ?
So,it works correctly now.
ls -l /proc/30999/fd
total 14
lrwx------ 1 root root 64 Oct 10 10:14 0 -> /dev/null
lrwx------ 1 root root 64 Oct 10 10:14 1 -> /dev/null
lrwx------ 1 root root 64 Oct 10 10:14 10 -> socket:[54758664]
lrwx------ 1 root root 64 Oct 10 10:14 11 -> socket:[54758665]
lrwx------ 1 root root 64 Oct 10 10:14 12 -> socket:[54758667]
lrwx------ 1 root root 64 Oct 10 10:14 13 -> socket:[54758668]
l-wx------ 1 root root 64 Oct 10 10:14 14 ->
/usr/local/nginx/logs/host.access.log
l-wx------ 1 root root 64 Oct 10 10:14 2 ->
/usr/local/nginx/logs/error.log
lrwx------ 1 root root 64 Oct 10 10:14 3 -> socket:[54758658]
l-wx------ 1 root root 64 Oct 10 10:14 4 ->
/usr/local/nginx/logs/error.log
lrwx------ 1 root root 64 Oct 10 10:14 6 -> socket:[54758656]
lrwx------ 1 root root 64 Oct 10 10:14 7 -> socket:[54758659]
lrwx------ 1 root root 64 Oct 10 10:14 8 -> socket:[54758661]
lrwx------ 1 root root 64 Oct 10 10:14 9 -> socket:[54758662]