ETIMEDOUT

Network - No response received within timeout period

Connection Timeout Errors

What It Means

A connection timeout occurs when a client waits too long for a server to respond. The server either didn't receive the request, is too slow to respond, or network issues are dropping packets.

# Browser error
ERR_CONNECTION_TIMED_OUT

# Node.js
Error: connect ETIMEDOUT 203.0.113.50:443

# curl
curl: (28) Connection timed out after 30001 milliseconds

# Python
socket.timeout: timed out

Types of Timeouts

Type Description
Connection timeout TCP handshake didn't complete in time
Read timeout Connected but response took too long
Socket timeout General network operation timeout
Request timeout Total time for complete request

Common Causes

  • Server unreachable: Server is down or IP is wrong
  • Firewall dropping packets: Silent drop instead of reject
  • Network congestion: Packets lost in transit
  • Server overloaded: Can't process requests fast enough
  • Routing issues: Packets can't reach destination
  • DNS pointing to wrong IP: Old IP that's no longer valid

Diagnosing the Issue

# Test basic connectivity
ping example.com
ping -c 4 203.0.113.50

# Trace the network path
traceroute example.com
mtr example.com

# Test TCP connection to specific port
nc -zv -w 5 example.com 443
telnet example.com 443

# Test with timeout
curl -v --connect-timeout 5 https://example.com

# Check where packets are dropping
sudo tcpdump -i any host example.com

# Test from different locations
# Use online tools like check-host.net

Timeout vs Connection Refused

  • Timeout: No response at all (packets dropped, server unreachable)
  • Connection Refused: Server actively rejects connection (fast RST response)

Timeout = silence. Connection refused = active rejection.

Firewall Rules

Firewalls often DROP packets silently instead of rejecting them, causing timeouts.

# Check if firewall is blocking outbound
sudo iptables -L OUTPUT -n

# Check cloud provider security groups
# AWS: Check inbound rules in Security Groups
# GCP: Check Firewall rules
# Azure: Check Network Security Groups

# Test if specific port is blocked
curl -v --connect-timeout 5 https://example.com:443
curl -v --connect-timeout 5 http://example.com:80

# If one works and the other doesn't,
# it's likely a port-specific firewall rule

Setting Appropriate Timeouts

Node.js / JavaScript

// fetch with timeout
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);

const response = await fetch(url, { signal: controller.signal });
clearTimeout(timeoutId);

// axios
axios.get(url, { timeout: 5000 });

// http module
http.request(options, callback).setTimeout(5000);

Python

# requests
requests.get(url, timeout=(3.05, 27))  # (connect, read)

# urllib
urllib.request.urlopen(url, timeout=10)

curl

# Connection timeout only
curl --connect-timeout 5 https://example.com

# Total timeout (including transfer)
curl --max-time 30 https://example.com

# Both
curl --connect-timeout 5 --max-time 30 https://example.com

Server-Side Configuration

# Nginx - increase timeouts for slow backends
proxy_connect_timeout 60s;
proxy_read_timeout 60s;
proxy_send_timeout 60s;

# Apache
Timeout 60
ProxyTimeout 60

# Node.js
server.timeout = 60000;  // 60 seconds
server.keepAliveTimeout = 5000;

Quick Fixes

  • Verify the IP is correct: dig example.com
  • Check firewall rules: Ensure port is open in security groups
  • Test from multiple locations: Determine if it's regional
  • Check server load: CPU, memory, network saturation
  • Increase timeout values: If server is legitimately slow
  • Add retries: Network issues can be transient

How to Monitor for Timeout Issues

Timeouts indicate performance problems that affect user experience. UptimeSignal tracks response times and alerts you when endpoints approach or exceed timeout thresholds. Catch degradation before it becomes a full outage. See also: 504 Gateway Timeout, 522 Connection Timed Out, Connection Refused.

Frequently Asked Questions

What causes a connection timeout error?
Connection timeout (ETIMEDOUT) occurs when no response is received within the timeout period. Causes: firewall silently dropping packets (DROP not REJECT), server down or unreachable, network routing issues, DNS resolution delays, server overloaded, or incorrect IP/hostname. Unlike connection refused, timeouts get no response at all.
What is the difference between connection timeout and read timeout?
Connection timeout = TCP handshake failed (server never acknowledged). Read timeout = connection succeeded but server didn't send data in time. Connection timeout suggests network/firewall issues. Read timeout suggests slow application processing (similar to 504 errors). They require different debugging approaches.
How do I fix timeout errors?
1. Verify reachability: ping hostname. 2. Check port: nc -zv hostname port. 3. Check firewall (REJECT is better than DROP for debugging). 4. Test from different networks to isolate the issue. 5. Check server load. 6. For read timeouts: optimize slow queries and external API calls.
Why does my request time out when the server is up?
A firewall between you and the server may be silently dropping packets. Cloud security groups, host-based firewalls, and network ACLs can all block traffic without sending a rejection. The server may also listen on a different interface (localhost only) or have a full connection backlog queue under high load.
What is the difference between connection refused and timeout?
Connection refused returns immediately (TCP RST -- port is closed). Timeout means no response at all (packets silently dropped). Refused = server is reachable but nothing is listening. Timeout = server is unreachable, firewall dropping packets, or wrong IP. Refused is faster to diagnose; timeouts require more investigation.

Detect timeout errors the moment they start

UptimeSignal monitors response times and alerts you when endpoints stop responding.

Set response time SLAs. 25 monitors free, unlimited for $15/month.

Related Errors & Resources