wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Leaking sockets on SIGHUP with rapidly reconnecting push_stream_subscriber client #113

Closed asmundg closed 10 years ago

asmundg commented 10 years ago

Using nginx 1.4.3 and wandenberg/nginx-push-stream-module@3d3a204177d3a7ab8a2858e04e792a6d11bf133f I get leaking sockets when SIGHUPing nginx while continuously connecting with a client:

/var/log/nginx/error.log:

2013/11/23 12:29:57 [alert] 30954#0: open socket #832 left in connection 3
2013/11/23 12:29:57 [alert] 30954#0: aborting

The FD list in /proc//fd/ accumulates socket FDs accordingly and they never appear to get released. This eventually causes nginx to completely stop working due to 'too many open files'.

Test setup:

/etc/nginx/nginx.conf:

events {
        worker_connections 786;
}

http {
        push_stream_shared_memory_size 100M;

        server {
                listen *;
                location /subscribe {
                        push_stream_channels_path $arg_channel;
                        push_stream_subscriber long-polling;
                }
        }
}

client:

$ while true; do curl -v 'http://localhost/subscribe?channel=foo' ; done

reload:

$ while true; do sudo service nginx reload; sleep 5; done
wandenberg commented 10 years ago

Hi @asmundg can you check if this commit 1a79b02541eb86adba27c128b75c05dceae6fdb6 solve the problem to you?

asmundg commented 10 years ago

I can't reproduce the error at all with 1a79b02541eb86adba27c128b75c05dceae6fdb6. Thanks!

wandenberg commented 10 years ago

this fix was merged to master