Scenario

The connection hangs and times out

The service listens on every address and answers instantly from the machine itself. A request to the machine's address hangs until it times out instead of being refused.

The same orders-api as in "The service is running and unreachable", with a different complaint. Monitoring shows it red again, but this time without the words connection refused: the request waits and gives up. The on-call engineer remembered last time and checked the socket's bind address, and it is fine. And there the ideas run out.

The symptom

From the machine itself everything answers. The socket listens on every address. And still a request to the machine's address hangs until it times out.

$ sudo service orders-api status
orders-api is running

$ curl -s http://localhost:8080/
orders-api ok

$ sudo ss -ltnp 'sport = :8080'
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      5            0.0.0.0:8080      0.0.0.0:*    users:(("orders-api",pid=64,fd=3))

$ curl -sS --max-time 3 http://$(hostname -I | awk '{print $1}'):8080/
curl: (28) Connection timed out after 3002 milliseconds

Compare the last line with the one from the previous scenario. There curl returned code 7 and the words Couldn't connect to server, and it returned them at once. Here it is code 28 and three seconds of silence. That is a different diagnosis, and it is worked through differently.

What you have to end up with

Three conditions. The API answers orders-api ok on the machine's outside address, answers within five seconds, and the firewa

Free with account

Finish this lesson with a free account

This lesson is free once you sign in. Create an account to keep reading and open the lab.

Create a free account

Already have an account? Sign in