Menu

Your HTTP client's default timeout is probably infinite: fix it in Python, Node, Go and curl
📰

Your HTTP client's default timeout is probably infinite: fix it in Python, Node, Go and curl

DEV Community: go·upordown.online·13 days ago
#6KYTLYEw
#devtogo#devto#dev#timeout#connect
Reading 0:00
15s threshold

A third-party API started answering slowly. Not failing, just slow: 90 seconds per request. Within ten minutes every worker in the service was stuck waiting on it, the queue backed up, and the site went down. The API never returned a single error.

The root cause was one missing argument: timeout= .

TL;DR

Several popular HTTP clients have no timeout by default , or one measured in minutes.

Set at least two: a connect timeout (short) and a read/total timeout (based on what the call should take).

A hung dependency without a timeout is worse than a dead one. Dead fails fast.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.