kalatabe
kalatabe

Reputation: 2989

Set default_socket_timeout to infinity?

I know that in /etc/php5/fpm/php.ini there is a setting called default_socket_timeout which in practice terminates connections that have not had a response pushed to them for a specific amount of time. I'm running a RabbitMQ-based AJAX "listener", which opens a connection and waits until it receives a response, if at all, then restarts itself.

The problem is that it may not receive a response for a long time - sometimes even up to 2 hours. When that happens the listener dies because it received 504 Gateway Timeout. I know the average load - it's an in-house system, only accessible to a certain office - so too many sockets won't be a problem. Is there any way to set default_socket_timeout to "no limits"? I tried default_socket_timeout=0, but that just reverts it to the default of 60 seconds.

Upvotes: 1

Views: 13639

Answers (2)

Rob
Rob

Reputation: 5481

For the sake of completeness:

default_socket_timeout=-1 

disables the timeout....

Upvotes: 7

kalatabe
kalatabe

Reputation: 2989

It turned out that my Gateway Timeout issue was not related to default_socket_timeout at all. I ended up putting fastcgi_read_timeout 3000; in my nginx PHP location block and it solved the issue. Here's how my config ended up:

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_read_timeout 3000;
}

This lets me have a long-running request that doesn't get cut off after 60 seconds.

Upvotes: 3

Related Questions