[uWSGI] STDIN never closed with CGI and POST

Roberto De Ioris roberto at unbit.it
Tue May 10 10:44:27 CEST 2016


> Hi, all:
>
> I'm trying to set up uwsgi with cgi plugin and git-http-backend, to
> see if we get better performance with uwsgi over fastcgi (http-git
> performance is fairly important to us for git.kernel.org).
>
> However, all my attempts have been in vain thus far, because attempting
> to clone always hangs -- GETs work just fine, but when we try to do a
> POST, git-http-backend enters endless read() and then things time out.
> Apparently, this is because STDIN with POST data is never closed.
>
> Here's my configuration:
>
> nginx (version 1.8.1):
>
> -------
> server {
>     root /var/www/html;
>     server_name git.example.com;
>
>     location / {
>         include uwsgi_params;
>
>         uwsgi_modifier1 9;
>         uwsgi_buffering off;
>         uwsgi_param GIT_HTTP_EXPORT_ALL "1";
>         uwsgi_param GIT_PROJECT_ROOT    /var/lib/git/repos;
>         uwsgi_param PATH_INFO           $1;
>         uwsgi_pass 127.0.0.1:10002;
>     }
> }
> -------
>
> uwsgi (version 2.0.12):
>
> -------
> [uwsgi]
> plugins = cgi
> uid = apache
> gid = apache
> post-buffering = 8192
> processes = 1
> threads = 50
> socket = :10002
> #cgi = /var/www/cgi-bin/foo
> cgi = /usr/libexec/git-core/git-http-backend
> logto = /var/log/uwsgi/git-http-backend/uwsgi.log
> -------
>
> The "foo" script I've used to narrow things down is as follows:
>
> -------
> #!/bin/bash
> cat "${1:-/dev/stdin}" > /var/tmp/foo-stdin
>
> # We never get here, it hangs above
> echo ";Finished stdin" >> /var/tmp/foo-stdin
>
> # This is here for testing via regular cgi interface with apache
> echo "Status: 200 OK"
> echo
> echo "OK"
> -------
>
> Anything I'm doing obviously wrong that STDIN is never closed? Is nginx
> the
> culprit here?
>
> I'm a bit stumped, so any help will be greatly appreciated.
>
> Regards
> --
> Konstantin Ryabitsev
> Linux Foundation Collab Projects
> Montréal, Québec
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>


Hi again, this patch should address it:

https://github.com/unbit/uwsgi/commit/ac1e354fcf16583a5b242bb0ed36fa5e3be41701
(just add cgi-close-stdin-on-eof = true to the options)

-- 
Roberto De Ioris
http://unbit.com


More information about the uWSGI mailing list