Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_proxy_uwsgi port parsing #1491

Open
wdauchy opened this issue Mar 22, 2017 · 5 comments · May be fixed by #1849
Open

mod_proxy_uwsgi port parsing #1491

wdauchy opened this issue Mar 22, 2017 · 5 comments · May be fixed by #1849

Comments

@wdauchy
Copy link

@wdauchy wdauchy commented Mar 22, 2017

Hello,

We faced a bug using mod_proxy_uwsgi when updating from 2.0.12 to 2.0.14 (with httpd 2.4.6).
We configured it to access uwsgi backend with port 3031 (ProxyPass / uwsgi://127.0.0.1:3031/), and it worked in 2.0.12.
But it seems that the configuration is not well parsed in 2.0.14 and we get :

uwsgi: attempt to connect to 127.0.0.1:0 (*) failed

We also saw that this is a known bug : http://lists.unbit.it/pipermail/uwsgi/2016-December/008622.html

We tried to find a fix in https://github.com/unbit/uwsgi, but didn't find anything.
So is there any current or future fix, or a wrong dependency in my configuration (e.g. minimal httpd version)?

Thanks,

@iksaif
Copy link

@iksaif iksaif commented Mar 29, 2017

What broke it was likely this commit

commit ffe57a2098c98d33efd063e5e045a41a6c7a231a
Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Date:   Fri Oct 2 15:42:34 2015 +0200

    mod_proxy_uwsgi: fix apache 2.4 integration with unix domain sockets
    
    Example usage in apache conf:
    
        ProxyPass "/foo"  "unix:/var/run/uwsgi/foo.socket|uwsgi://uwsgi-uds-foo/"
    
    Note: I use uwsgi-uds-foo as hostname instead of localhost because if
    you have multiple entrie like these in the same apache conf, apache
    thinks it is the same backend even though the unix socket path is
    different. So it is mandatory to use different hostnames if you have
    multiple app sockets.
    
    Some references:
    - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752783
    - https://github.com/unbit/uwsgi/issues/973
    - maybe https://github.com/unbit/uwsgi/issues/912
    - https://github.com/unbit/uwsgi/issues/890

With ProxyPass / uwsgi://127.0.0.1:3031/

[Wed Mar 29 08:14:57.806201 2017] [proxy:error] [pid 21890:tid 140167933638400] (111)Connection refused: AH00957: uwsgi: attempt to connect to 127.0.0.1:0 (*) failed
[Wed Mar 29 08:14:57.806272 2017] [:error] [pid 21890:tid 140167933638400] [client x.x.x.x:51434] failed to make connection to backend: 127.0.0.1:0
[Wed Mar 29 08:14:57.965182 2017] [proxy:error] [pid 21890:tid 140167925245696] (111)Connection refused: AH00957: uwsgi: attempt to connect to 127.0.0.1:0 (*) failed
[Wed Mar 29 08:14:57.965201 2017] [:error] [pid 21890:tid 140167925245696] [client x.x.x.x:51436] failed to make connection to backend: 127.0.0.1:0, referer: http://graphite-global-web

With ProxyPass / uwsgi://127.0.0.1:3032/

[Wed Mar 29 08:13:27.461656 2017] [proxy:error] [pid 21541:tid 139999190169344] (111)Connection refused: AH00957: uwsgi: attempt to connect to 127.0.0.1:3032 (127.0.0.1) failed
[Wed Mar 29 08:13:27.461704 2017] [proxy:error] [pid 21541:tid 139999190169344] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Wed Mar 29 08:13:27.461712 2017] [:error] [pid 21541:tid 139999190169344] [client x.x.x.x:51406] failed to make connection to backend: 127.0.0.1:3032
[Wed Mar 29 08:13:27.579564 2017] [proxy:error] [pid 21541:tid 139999181776640] AH00940: uwsgi: disabled connection for (127.0.0.1)
[Wed Mar 29 08:13:43.527742 2017] [proxy:error] [pid 21541:tid 139999148205824] AH00940: uwsgi: disabled connection for (127.0.0.1)
[Wed Mar 29 08:13:43.622006 2017] [proxy:error] [pid 21541:tid 139999139813120] AH00940: uwsgi: disabled connection for (127.0.0.1)
[Wed Mar 29 08:14:01.596094 2017] [proxy:error] [pid 21541:tid 139999106242304] AH00940: uwsgi: disabled connection for (127.0.0.1)
[Wed Mar 29 08:14:01.692000 2017] [proxy:error] [pid 21541:tid 139999097849600] AH00940: uwsgi: disabled connection for (127.0.0.1)

This comes from proxy_utils.c

                ap_log_error(APLOG_MARK, loglevel, rv, s, APLOGNO(00957)
                             "%s: attempt to connect to %pI (%s) failed",
                             proxy_function,
                             backend_addr,
                             worker->s->hostname);

I tried putting it in a balancer, and I could see :3031 on /balancer-status, so I'm not totally sure this is a bug with mod_proxy_uwsgi itself.

Loading

@froggleston
Copy link

@froggleston froggleston commented Sep 25, 2017

Hi there,

Has anything further been discovered about this bug? I'm hitting this exact issue with Apache 2.4 and mod_proxy_uwsgi.

Cheers

Rob

Loading

@tarunkhanna
Copy link

@tarunkhanna tarunkhanna commented Mar 14, 2018

Any update on this? I'm seeing the same issue with mod_proxy_uwsgi-2.0.17, apache-2.4.23 and uwsgi-2.0.13.1. Thank you.

Loading

@froggleston
Copy link

@froggleston froggleston commented Mar 20, 2018

@tarunkhanna I moved over to asgi/daphne as I couldn't work around this bug.

Loading

@tarunkhanna
Copy link

@tarunkhanna tarunkhanna commented Mar 20, 2018

@froggleston Thanks. There is a bug in the code and the original committer has proposed a solution. This commit seems to have caused the issue. The original committer has proposed a change that should fix it.

Loading

tarunkhanna referenced this issue Mar 20, 2018
Example usage in apache conf:

    ProxyPass "/foo"  "unix:/var/run/uwsgi/foo.socket|uwsgi://uwsgi-uds-foo/"

Note: I use uwsgi-uds-foo as hostname instead of localhost because if
you have multiple entrie like these in the same apache conf, apache
thinks it is the same backend even though the unix socket path is
different. So it is mandatory to use different hostnames if you have
multiple app sockets.

Some references:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752783
- #973
- maybe #912
- #890
@niol niol linked a pull request that will close this issue Aug 10, 2018
danvratil added a commit to danvratil/dvratilcz that referenced this issue Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants