-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Intermittent 502 proxy errors when running behind Apache #2687
Comments
Do you see anything in the logs from aiohttp? How are you running aiohttp? With gunicorn or directly? I guess debug level logs from aiohttp (and gunicorn if it's running) would help. Also how is the aiohttp server addressed by apache (by an ip or a hostname)? I've had similar issues that turned out to be DNS problems which were fixed by using static IPs. |
Hi @samuelcolvin, |
Maybe related to #2682 |
Hello @asvetlov, Do you have any recommendation for us to validate the source of the issue? How can we help you guys resolve this problem? |
I'm working on it |
Sorry, after digging in I did not found expected bug. aiohttp error log is required (with DEBUG level enabled) for getting more information about the problem. |
I'm having something similar, running aiohttp behind zuul proxy. After several good responses, and a while of doing nothing, server starts responding with incorrect response, which starts with |
|
Hi @asvetlov, We tried to check the aiohttp debug logs, that's how we tried to do it, and how we are running the app:
We ran the app with this configuration, but were unable to see anything related to the problematic requests - they do not even register in the access log. I'm posting the Apache config below, hope it might help you reproduce it. Apache Configurationapache2.confDefault config. Nothing special here. sites-enabled
Apache Error Logs
|
Errors are stored in logger named |
I spend few hours to produce some small replicable example with no luck. If anything changes I will let you know, thanks anyway! |
Hi @asvetlov, running the app with |
Hi everyone, We eventually managed to solve the problem by adding this to our apache proxy config: |
@panovitch do you have the chance to test if the error is reproducible with Aiohttp 3.x? Regarding the |
I am seeing this with |
Hello, |
Running into similar issue with aiohttp + gunicorn + apache2.
In my environment, I'm not allowed to change |
Apache uses multithreaded/multiprocessed workers to process http requests. Sorry, I've not motivated to support aiohttp+apache combination. If somebody wants to provide a pull request -- you are welcome. |
FTR this is not entirely true. You can configure it the way nginx works. |
I don't have control over our infrastructure, Apache2 is used as reverse proxy for all our containers. I spent time learning aiohttp, enjoyed it and thanks a lot your work on this project. On my side I think I'll have to work with another stack. Maybe add a note in documentation on Apache not being currently supported as a reverse proxy? |
From my understanding, event worker still uses async mode for inactive connections only. Which may work in some scenarios though. |
Related to aio-libs#2687
Random question, many moons later: what is your transfer-encoding set to? |
Hi there! Was wondering if you have some insight on the following problem:
Long story short
We are running an aiohttp app behind an Apache proxy. Around 20% of requests to the app cause Apache to return 502 Proxy Error.
These happen with requests to all endpoints of the server, and there seems to be no pattern to errors of any kind. The proxy error is returned immediately upon request.
Other servers/apps (built on other frameworks, for example, tornado) run behind the same Apache proxy and do not show the same behavior.
The example of Apache logs:
Full error response example:
Your environment
aiohttp==2.3.9
python 3.6.3
Apache 2.4.18
The text was updated successfully, but these errors were encountered: