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

Nginx closes socket at random intervals #219

Closed lelikg closed 8 years ago

lelikg commented 8 years ago

Hi, I have a ws and wss implementation, and the server keeps closing the socket at random intervals. Nothing in the logs about this. I am using the live_thumb implementation

Please help!

wandenberg commented 8 years ago

Which nginx and module versions are you using? Can you share your configuration? Maybe you need to tune some parameters at your OS like sockets buffer size. On Dec 14, 2015 4:48 AM, "Leon Gordin" notifications@github.com wrote:

Hi, I have a ws and wss implementation, and the server keeps closing the socket at random intervals. Nothing in the logs about this. I am using the live_thumb implementation

Please help!

— Reply to this email directly or view it on GitHub https://github.com/wandenberg/nginx-push-stream-module/issues/219.

lelikg commented 8 years ago

Hi, here is some of the configuration:

http config:

send_timeout                    10;
client_body_timeout             10;
client_header_timeout           10;
client_header_buffer_size       1k;
large_client_header_buffers     1 2k;
client_max_body_size            1k;
client_body_buffer_size         1k;
ignore_invalid_headers          on;

push_stream_shared_memory_size              100m;
push_stream_max_channel_id_length           200;
# max messages to store in memory
push_stream_max_messages_stored_per_channel  20;
# message ttl
push_stream_message_ttl                      5m;
push_stream_subscriber_connection_ttl        15m;
# connection ttl for long polling
push_stream_longpolling_connection_ttl        30s;

server config

#optimizations
sendfile           on;
tcp_nopush         on;
tcp_nodelay        on;
keepalive_timeout  15;

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 16k;

location publisher and socket config:

location /live-pub {
    # activate publisher mode for this location, with admin support
    push_stream_publisher admin;

    # query string based channel id
    push_stream_channels_path $arg_id;

    # store messages in memory
    push_stream_store_messages off;

    # Message size limit
    # client_max_body_size MUST be equal to client_body_buffer_size or
    # you will be sorry.
    client_max_body_size 4000k;
    client_body_buffer_size 4000k;
}

#Websockets support (inside server directive)
location ~ /live-ws/(.*) {
    # activate websocket mode for this location
    push_stream_subscriber websocket;

    # positional channel path
    push_stream_channels_path $1;

    push_stream_message_template "~text~";
}
wandenberg commented 8 years ago

@lelikg you forgot to answer which nginx and module versions you are using. According to your configuration each 15 minutes the subscriber will be disconnected or when an write operation on the socket happens. How are you measuring this random socket close actions? Is it an easy scenario to reproduce? How?

lelikg commented 8 years ago

Hi @wandenberg sorry for my late reply Nginx version is 1.8.0 Push stream module 0.5.1

Sockets close randomly, sometimes right away after about 10 messages, and sometimes they run for more than 5 minutes.

I can send you a link for tests in a private message. Thanks

wandenberg commented 8 years ago

Hi @lelikg can you try this version 876508f83676122ffbd4253ae11ae8ef8968601b Also send me the access to the server if you want.