proxy.py: [ReverseProxyPlugin] Fails to process request when response is too big
Describe the bug I try the reverse proxy example from README.md by starting proxy.py with (hopefully) appropriate flags (check below for invocation) and send simple requests using curl. For some reason proxy sporadically fails and times out after ~10 secs and client isn’t receiving the response body. This happens around 20% of the times; the rest of them it’s working fine.
To Reproduce
- Run
proxy.py
aspython -m proxy --disable-http-proxy --enable-web-server --plugins proxy.plugin.ReverseProxyPlugin --hostname 127.0.0.1
- Use the curl example found in README.md
curl -v http://127.0.0.1:8899/get
. When reproducible I get:
$ curl -v http://127.0.0.1:8899/get
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8899 (#0)
> GET /get HTTP/1.1
> Host: 127.0.0.1:8899
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 10 Feb 2020 18:01:15 GMT
< Content-Type: application/json
< Content-Length: 250
< Connection: keep-alive
< Server: gunicorn/19.9.0
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
<
* transfer closed with 250 bytes remaining to read
* Closing connection 0
curl: (18) transfer closed with 250 bytes remaining to read
- The proxy.py output is:
$ python -m proxy --disable-http-proxy --enable-web-server --plugins proxy.plugin.ReverseProxyPlugin --hostname 127.0.0.1
2020-02-10 20:00:55,637 - pid:49866 [I] load_plugins:525 - Loaded plugin proxy.http.server.HttpWebServerPlugin
2020-02-10 20:00:55,637 - pid:49866 [I] load_plugins:525 - Loaded plugin proxy.plugin.ReverseProxyPlugin
2020-02-10 20:00:55,637 - pid:49866 [I] listen:63 - Listening on 127.0.0.1:8899
2020-02-10 20:00:55,652 - pid:49866 [I] start_workers:84 - Started 8 workers
2020-02-10 20:01:09,716 - pid:49870 [I] access_log:232 - 127.0.0.1:49854 - GET /get - 10381.46 ms
2020-02-10 20:01:25,265 - pid:49870 [I] access_log:232 - 127.0.0.1:49917 - GET /get - 10297.06 ms
2020-02-10 20:01:36,078 - pid:49867 [I] access_log:232 - 127.0.0.1:50003 - GET /get - 277.89 ms
Notice the first 2 requests timing out at ~10 seconds and the 3rd going through fine.
Expected behavior Was expecting to handle all requests without issues.
Version information
- OS: MacOS Catalina (10.15.2 (19C57))
- Browser: N/A (using curl, but same happens for postman)
- Device: MacBook Pro Mid 2015
- proxy.py Version: v2.1.2, also tried latest from develop and results are the same
Additional context Happy to help by debugging further & providing a patch for this (if indeed an issue), just need some pointers on where to look 😃
Screenshots N/A
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 25 (12 by maintainers)
I see your point @abhinavsingh, it’s just too bad we couldn’t sync at that time to agree on needed changes and get them out the door. Anyway, let me know if you have a plan to adapt this in a way that makes more general sense for the project and I’ll be happy to help.
Best regards