-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Gunicorn inside docker intermittently sending RST packet to the client causing connection reset with no logs #2714
Comments
This reminds me of #2698 where the user was running into socket backlog issues. Adding more workers to keep up with the number of requests or tuning TCP settings to allow for a bigger backlog solved the problem. |
@jamadden thanks for your reply. The issue you are referring to mentions multiple concurrent requests. In my case, there are no concurrent requests or any other requests being sent, other than what's present in the tcpdumb log. What can I do to troubleshoot this further? Is there any way I can turn on more logging for tcp events in gunicorn to see where disconnect is coming from? |
We have some similar issue, did you find a solution? |
@NicolasHoferer No I have not. I ended up switching to gevent.pywsgi and have been using it in both development and production environments with 0 issues. I know this isn't what community wants to hear but until this is fixed or there are tools and documentation to troubleshoot issues like that, I would not consider gunicorn for production. If I had time/resources to troubleshoot further I would look into adding trace log level to gunicorn that would basically print every tcp/socket packet and operation and try to find what's causing abrupt connection losses. |
seems like the backlog is too short. This is an old issue. Let's cvlosing it for now. If it's still reproducible, please open a new ticket with details to reproduce it. |
How to increase the backlog on an openshift cluster? |
@benoitc Perhaps I should have explained this better but there are no concurrent connections being made in my original issue. Only one client making 2 sequential http requests. I don't see how this could be related to the backlog size unless the default backlog size is 1. To me it seems to be some race condition with sequential http requests being sent one right after another. However since I am not using gunicorn anymore I can not prove that. |
Sorry for the spam, a new item was asked. moved comments there. |
I am running gunicorn inside a docker container, with a pretty basic configuration:
There is no nginx in front of it and no high load besides this one client (this is a dev/staging environment).
Sometimes, connection on the client is being reset.
Looking with WireShark (both on the client machine, host machine and using tcpdump inside a docker network) it looks like gunicorn is sending RST packet(s) right after http request packets are sent:
Despite the debug log level, there are no meaningful logs regarding this request Last log I see in gunicorn is "GET /info/data_model_checksums" (previous http request right before the failed one). From the gunicorn logs perspective it looks like it never received that request. Using pre_request hook also did not bear any fruit. I am unsure what else I should do in order to troubleshoot this issue.
What makes it difficult is, it seems this problem relies on client sending multiple requests one after another, and depends on timings with these requests. Changing random pieces makes the error (temporarily?) go away. Testing with curl does not replicate the issue.
Retrying and sending the same web request again, always succeeds.
If I put nginx in front of the gunicorn in another container, the problem seems to go away, but I don't feel comfortable with that "solution" and would like to understand the root cause of this.
The text was updated successfully, but these errors were encountered: