KQueue: 2 or more IPv6 listen ports + HUPing causes repeated log spam

WolfSage nginx-forum at nginx.us
Wed Jul 7 19:06:35 MSD 2010


With 2 or more IPv6 listen ports enabled in nginx, if you send it about
3-4 HUPs, it will start to log spam repeatedly in
/var/log/nginx-error.log until the partition fills up with the following
error message:
[quote][alert] 4104#0: kevent() failed (9: Bad file descriptor)[/quote]

I've tested this on FreeBSD 6.2, both 32-bit single-core and 64-bit
multi-core, as well as FreeBSD 7.1 64-bit multi-core.

To repeat:

Start up nginx with the following config file:
[quote]
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    server {
        listen       [::]:8001;
        listen       [::]:8002;
    }
}
[/quote]

Send it a single HUP. Nothing should be reported in
/var/log/nginx-error.log

Send it another HUP, the following should appear in the log:
[quote]
[alert] 4088#0: kevent() error on 6 filter:-1 flags:4000 (9: Bad file
descriptor)
[emerg] 4085#0: close() socket [::]:8002 failed (9: Bad file
descriptor)
[alert] 4088#0: kevent() error on 6 filter:-1 flags:4000 (9: Bad file
descriptor)
[/quote]

Now send it 1-2 more hups, (maybe a few more might be necessary), and
the following will appear:
[quote]
[alert] 4081#0: sendmsg() failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[emerg] 4101#0: close() socket [::]:8002 failed (9: Bad file
descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4081#0: close() channel failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4081#0: sendmsg() failed (9: Bad file descriptor)
[/quote]

And then the line from above will be repeated endlessly:
[quote]
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
[alert] 4104#0: kevent() failed (9: Bad file descriptor)
...
[/quote]

I've found that if you only have 1 IPv6 listen port, this doesn't
happen. I also haven't been able to reproduce it with IPv4 listen
ports.

-- WolfSage (Matthew Horsfall)

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,106308,106308#msg-106308




More information about the nginx mailing list