-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
[cheroot==8.1.0 regression] Occasional connection resets with concurrent requests #263
Comments
Hm.. I cannot reproduce this on my laptop (Gentoo Linux, Python 3.7). But I probably have some different kernel limits maybe: $ cat /proc/sys/net/core/somaxconn
128
$ sysctl -n net.core.somaxconn
128 @tobiashenkel could you pls check what value you have there? Can you set Ref: https://stackoverflow.com/a/2444483/595220 P.S. Another thing I noticed is that the network stack is completely different in these examples: tornado picks asyncio as its event loop so some settings may derive from this lib while Cheroot only has a synchronous thread-based implementation. |
Another setting to check: $ sysctl -n net.ipv4.tcp_abort_on_overflow
0 |
Another ref on the connection backlog: https://serverfault.com/a/715873/111608 |
Thanks, I re-tested and checked the mentioned settings: Re-tested with somaxconn and socket_queue_size of 128 and 1024 on ubuntu with no change on the observed behavior. The Ubuntu test has been done on a freshly created VM in aws. |
I'll need to test it in ubuntu container, then... Meanwhile, try downgrading to |
I've successfully reproduced the issue directly with cheroot with this server code: from cheroot import wsgi
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
return [b'Hello world!']
addr = '0.0.0.0', 5000
server = wsgi.Server(addr, my_crazy_app)
server.start() The client code needed a few more threads though without cherrypy in the mix. |
FTR the client reproducer code uses |
Interesting, I can't seem to reproduce it with $ ab -v4 -k -c 1020 -t 5 http://localhost:5000/info (doesn't reuse connections?) |
I know what the cause of this is and I've got an in-progress fix for it. I'll post an update shortly. |
@the-allanc thanks! Will it also fix #249? |
I'd be surprised if it does, but I'd be happy if it did. I've submitted #277 to address this issue. |
CherryPy uses cheroot underneath as http server. The release 8.1.0 introduced a regression which leads to occasional connection resets while handling concurrent requests [1]. Cap it until there is a release available that fixes this issue. [1] cherrypy/cheroot#263 Change-Id: I39716e9c203cc42ab320cb47e090fbc8f67320c9
I'm submitting a ...
Do you want to request a feature or report a bug?
Reporting a bug
What is the current behavior?
When running concurrent requests against a cherrypy the client occasionally gets 'Connection reset by peer' errors.
If the current behavior is a bug, please provide the steps to reproduce and if possible a screenshots and logs of the problem. If you can, show us your code.
This can be reproduced by running the following server and client code. Tested both on MacOS with python 3.7 and Ubuntu bionic on python 3.6. Both reveal the same connection errors:
When reproducing locally the issue reproduces already with 20 workers occasionally and with 50 workers on every run of the client script. I also played with various values of threadpool and queue size settings but couldn't get it working.
Server code:
Client code:
We see the same behavior when running a production service between apache as a reverse proxy.
What is the expected behavior?
There are no 'Connection reset by peer' errors.
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, e.g. stackoverflow, gitter, etc.)
Note that when running with Tornado as HTTP server the problem doesn't reproduce:
The text was updated successfully, but these errors were encountered: