Nc: connect to 127.0.0.1 port 5000 (tcp) failed: Connection timed out After a couple of dozen of runs this is what we saw: $ nc 127.0.0.1 5000 -v Once we knew what to look for we were able to reproduce this with good old netcat. To be precise, an NGINX instance was trying to establish a TCP connection to our internal acceleration service on localhost. After a lot of debugging we identified an important symptom: sometimes, once in thousands of runs, our test program failed to establish a connection between two daemons on the same machine. The root cause of this issue was pretty complex. The internet connectivity between CloudFlare and origin was perfect. In the case I was debugging it was neither. Most often the blame is on the origin server side - the origin server is slow, offline or encountering high packet loss. Apparently every now and then a connection going through CloudFlare would time out with 522 HTTP error.ĥ22 error on CloudFlare indicates a connection issue between our edge server and the origin server. I was asked to debug another weird issue on our network.