[uWSGI] uwsgi does not flush output

Chan Guan Hao guanhao3797 at gmail.com
Fri Mar 4 05:38:05 CET 2016


Wow thanks for the help, it worked. :) Just set `uwsgi_buffering off` in
the nginx directive and it works.

http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_buffering

On Fri, Mar 4, 2016 at 1:48 AM, Tim Tisdall <tisdall at gmail.com> wrote:

> If I'm understanding you correctly, you want it to flush periodically and
> not just one big dump at the end, right?
>
> I don't have access to the code base of the project where I had to deal
> with this same issue, but I remember that it had to do with buffering
> happening in nginx.  You can try setting the "X-Accel-Buffering" http
> header to temporarily turn buffering on/off and test if that fixes your
> issue.  You can see all of the uwsgi buffer settings here:
> http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html
>
> On 3 March 2016 at 11:15, Chan Guan Hao <guanhao3797 at gmail.com> wrote:
>
>> I'm not sure how I can explain this better. But
>> http://128.199.139.161/api/search/?keyword=headphones&page=1 shows what
>> I'm saying.
>>
>> This URL sends JSON over and I have verified that the WSGI function runs
>> without exceptions and returns the complete payload. But somehow it still
>> continuously loads, without sending over the full payload.
>>
>> However, when I am running it myself manually, and when I stop the uwsgi
>> instance with CTRL-C, the output gets flushed out to the browser. So I have
>> a gut feeling that it's uwsgi that's not closing a connection or something.
>>
>> This is the uwsgi log:
>> `[pid: 4020|app: 0|req: 1/3] 110.159.164.57 () {44 vars in 838 bytes}
>> [Thu Mar  3 10:53:08 2016] GET /api/search/?keyword=headphones&page=1 =>
>> generated 19103 bytes in 4244 msecs (HTTP/1.1 200) 2 headers in 74 bytes (1
>> switches on core 0)`
>>
>> This is the nginx log:
>> `2016/03/03 10:45:29 [error] 907#0: *321 upstream timed out (110:
>> Connection timed out) while reading upstream, client: 110.159.164.57,
>> server: 128.199.104.232, request: "GET
>> /api/search/?keyword=headphones&page=1 HTTP/1.1", upstream: "uwsgi://
>> 127.0.0.1:8080", host: "128.199.139.161"`
>>
>> After seeing this in the nginx log, I was sure that nginx was not the
>> culprit in the infinite loading issue because it was expecting uwsgi to
>> close the connection.
>>
>> My uwsgi configuration:
>>
>> ```
>> [uwsgi]
>> module = app
>> callable = app
>> master = true
>> processes = 5
>> vacuum = true
>> socket = 127.0.0.1:8080
>> die-on-term = true
>> log-to = /root/cheapchirp/logs/server.log
>> pyhome = /root/cheapchirp/env
>> ```
>>
>> Extra details: Flask, Python 2.7.6
>>
>> _______________________________________________
>> uWSGI mailing list
>> uWSGI at lists.unbit.it
>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>
>>
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20160304/c288976f/attachment.html>


More information about the uWSGI mailing list