Welcome! Log In Create A New Profile

Advanced

Re: debugging 504 Gateway Time-out

Larry Martell
August 14, 2016 08:06PM
On Tue, Aug 9, 2016 at 10:35 PM, Richard Stanway
<r1ch+nginx@teamliquid.net> wrote:
>> generated 0 bytes in 640738 msecs
>
> I would look into what is causing your backend to take over 10 minutes to
> respond to that request.

I have some requests that can take a long time to return - the users
can request huge amount of data to be pulled from very large database
tables with complex filters. But what I don't understand it how the
nginx timeout works. My config file has this:

proxy_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
send_timeout 600;

That's 10 minutes, right? But I get the 504 response before 10 minutes
have passed since the request is sent. Why is that?

>
> On Tue, Aug 9, 2016 at 11:09 PM, Larry Martell <larry.martell@gmail.com>
> wrote:
>>
>> I just set up a django site with nginx and uWSGI. Some pages I go to
>> work fine, but other fail with a 504 Gateway Time-out. I used to
>> serve this site with apache and wsgi and these same pages worked fine.
>>
>> This is what I see in the nginx error log:
>>
>> 2016/08/09 16:40:19 [error] 17345#0: *1 upstream timed out (110:
>> Connection timed out) while reading response header from upstream,
>> client: 10.250.147.59, server: localhost, request: "GET
>>
>> /report/CDSEM/MeasurementData/?group=&target_name=&recipe=&ep=&ppl=&roi_name=&lot=&date_time=8%2F1&tool_ids=23&field_1=Tool&field_2=Target&field_3=Recipe&field_4=Ep&field_5=Lot&field_6=Date+Time&field_7=Bottom&submit_preview=Generate+Report
>> HTTP/1.1", upstream: "uwsgi://unix:///usr/local/motor/motor.sock",
>> host: "xx.xx.xx.xx", referrer:
>> "http://xx.xx.xx.xx/report/CDSEM/MeasurementData/"
>>
>> When this happens I see this in the uwsgi error log:
>>
>> Tue Aug 9 16:42:57 2016 -
>> uwsgi_response_writev_headers_and_body_do(): Broken pipe
>> [core/writer.c line 296] during GET
>>
>> /report/CDSEM/MeasurementData/?group=&target_name=&recipe=&ep=&ppl=&roi_name=&lot=&date_time=8%2F1&tool_ids=23&field_1=Tool&field_2=Target&field_3=Recipe&field_4=Ep&field_5=Lot&field_6=Date+Time&field_7=Bottom&submit_preview=Generate+Report
>> (10.250.147.59)
>> IOError: write error
>> [pid: 9230|app: 0|req: 36/155] 10.250.147.59 () {46 vars in 1333
>> bytes} [Tue Aug 9 16:32:16 2016] GET
>>
>> /report/CDSEM/MeasurementData/?group=&target_name=&recipe=&ep=&ppl=&roi_name=&lot=&date_time=8%2F1&tool_ids=23&field_1=Tool&field_2=Target&field_3=Recipe&field_4=Ep&field_5=Lot&field_6=Date+Time&field_7=Bottom&submit_preview=Generate+Report
>> => generated 0 bytes in 640738 msecs (HTTP/1.1 200) 4 headers in 0
>> bytes (1 switches on core 0)
>>
>> Note the weird timestamps. The first uwsgi message is more then 2
>> minutes after the nginx message. And the second uwsgi message has a
>> timestamp before the previous uwsgi message. What's up with that??
>>
>> Here is my nginx config:
>>
>> worker_processes 1;
>>
>> events {
>> worker_connections 1024;
>> }
>>
>> http {
>> include mime.types;
>> default_type application/octet-stream;
>> keepalive_timeout 65;
>> sendfile on;
>>
>> # set client body size to 20M
>> client_max_body_size 20M;
>>
>> include /etc/nginx/sites-enabled/*;
>> }
>>
>>
>> and here is my local site file:
>>
>> # motor_nginx.conf
>>
>> # the upstream component nginx needs to connect to
>> upstream django {
>> server unix:///usr/local/motor/motor.sock; # for a file socket
>> }
>>
>> # configuration of the server
>> server {
>> # the port your site will be served on
>> listen 80;
>> # the domain name it will serve for
>> server_name localhost;
>> charset utf-8;
>>
>> # max upload size
>> client_max_body_size 75M; # adjust to taste
>>
>> proxy_read_timeout 600;
>> proxy_connect_timeout 600;
>> proxy_send_timeout 600;
>> send_timeout 600;
>>
>> # Django media
>> location /media {
>> alias /usr/local/motor/motor/media;
>> }
>>
>> location /static {
>> alias /usr/local/motor/motor/static;
>> }
>>
>> # Finally, send all non-media requests to the Django server.
>> location / {
>> uwsgi_pass django;
>> include /usr/local/motor/motor/uwsgi_params;
>> }
>> }
>>
>> How can I debug or fix this?
>>
>> Thanks!

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

debugging 504 Gateway Time-out

Larry Martell August 09, 2016 05:12PM

Re: debugging 504 Gateway Time-out

Richard Stanway August 09, 2016 10:38PM

Re: debugging 504 Gateway Time-out

Larry Martell August 14, 2016 08:06PM

Re: debugging 504 Gateway Time-out

Francis Daly August 15, 2016 04:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready