principleMajorpending
Timeouts everywhere -- never wait forever
Viewed 0 times
timeoutconnection timeoutstatement_timeouthangresource exhaustioncircuit breaker
Problem
Operations without timeouts hang indefinitely when dependencies fail: HTTP requests to a dead server, database queries on a locked table, message queue consumers waiting for messages that never come.
Solution
Set timeouts on every external operation: (1) HTTP: request timeout (connection + read). (2) Database: statement_timeout, lock_timeout, connection timeout. (3) Queue: consumer timeout, visibility timeout. (4) Locks: acquire with timeout, not forever. (5) Subprocess: always set a timeout. Default: fail after a reasonable time rather than hang. Combine with circuit breakers for repeated timeouts.
Why
A hanging operation holds resources (threads, connections, memory) indefinitely. In a server, enough hanging requests exhaust the thread/connection pool, causing a cascading failure.
Revisions (0)
No revisions yet.