110 Connection Timed Out

Hi there.

This morning I noticed that my site was running extremely slow. Logging into the server, I noticed that the cpu and ram were barely being touched. I’m on a 8gb box from Media Temple.

Tailing my error logs, I see this:

upstream timed out (110: Connection timed out) while reading response header from upstream everywhere. Restarting the server fixes it for about 10 minutes, then the site starts to timeout again.

I’ve not changed anything on the server after provisioning it.

Please help.

PHP and Nginx have fairly low default settings for request sizes and memory usage - for example, I created a form which allowed visitors to upload a 5mb file - I had to adjust settings in both PHP and Nginx to facilitate this.

I’m not entirely sure what default settings Trellis enables but if there’s anything at all on your pages, or any installed plugins which would increase memory usage or request size, I’d start there.

Also, check your access logs - I had a plugin issue once where search engine crawling requests skyrocketed due to a plugin script being poorly configured.

Update: maybe list your plugins here, so anyone with any experience of them can recommend possible troubleshooting steps…

1 Like

I ended up having to add buffers into my nginx.conf

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

4 Likes

There’s some good information on these settings:


We’ll need to look into providing better defaults for these.

2 Likes

This is actually the guide I used to determine by buffer size. I do agree that we need better defaults.

3 Likes

Hi there, I’m having the same issue and I can’t figure it out!

The values from
awk '($9 ~ /200/) { i++;sum+=$10;max=$10>max?$10:max; } END { printf("Maximum: %d\nAverage: %d\n",max,i?sum/i:0); }' access.log
are:
Maximum: 1691274
Average: 20259

so I’ve tried several values till 2048, but nothing changed.

fastcgi_buffers 2048 32k;
fastcgi_buffer_size 32k;

The timeout happen trying to retrieve lost password.
Strange is that wp-.*.php rule should avoid caching for wp-login.php route

I’m using a 512Mb DigitalOcean droplet

Thanks for any advice

UPDATES

In my specific case the timeout was related to mail sending.
Using a SMTP plugin solved.

2 Likes

After having some troubles with the same errors I edited nginx.conf the same way and it seems to solve it so far. However as I changed it directly in the vagrant box it will be overwritten one day when preprovisioning the machine.

So I wonder where I could set it as default in the trellis config files. In the ansible file I find {{ nginx_fastcgi_buffers }}and wonder whether I could set it e.g. in group_vars/develpment/main.yml

Thank you in advance and best regards,

Philipp