1

I have a stack of Flask, Nginx, Gunicorn deployed on AWS. There are a set of API routes present on it, and when I try to make requests to the /api/login path, the Postman request hangs randomly. At this point, I do not see any change in nginx error log( enabled with debug), flask+ gunicorn application logs (flask logs connected to gunicorn logs, on Debug level), or even the TCPdump and tshark running on the server do not log any packets sent or recieved during that time.

The requests remains pending in Postman for a very long time, and never gets resolved, only throwing an error

Error: socket hang up

Warning: This request did not get sent completely and might not have all the required system headers

Most of the requests go through fine, but every once in a while one will hang like this.

Community
  • 1
  • 1
  • This question may help: https://stackoverflow.com/questions/31864707/node-socket-hang-up-error-with-http – XavierBrt Feb 04 '20 at 10:24
  • @XavierBrt I had a look at that and more related links from it, they all seem to deal with client side errors, but my issue happens randomly from all sorts of clients, e.g., Postman, React-Native app calling ethe API, etc. I believe this is a server side issue therefore – Kunal Gupta Feb 04 '20 at 10:43
  • 1
    Could you try to reproduce the same by bypassing Nginx and Gunicorn and hitting the application directly? Also, it would be helpful if you could put up the relevant parts of Gunicorn and Nginx config used – Saiprasad Balasubramanian Feb 04 '20 at 19:06
  • @SaiprasadBalasubramanian the problem is with reproducing the error in the first place. Since it is so random and I still have no idea what causes it, it might go through fine a 100 times, then might fail randomly. Setting up a script which tests the API repeatedly does not encounter the issue even after 1000 retries, spaced 10 seconds apart – Kunal Gupta Feb 05 '20 at 13:53
  • @KunalGupta do use mongoDB? – Alireza Jun 08 '20 at 11:35
  • @ALH We do use mongodb – Kunal Gupta Aug 23 '20 at 21:18
  • @KunalGupta Did you figure out the problem? I am facing something similar and can't seem to pinpoint the exact problem. – ibininja Feb 06 '21 at 05:54
  • @ibininja I was not able to figure out the route cause unfortunately. We just had to build extra fallbacks into the application to handle it – Kunal Gupta Mar 30 '21 at 15:29

0 Answers0