Proxy thread limit reached: what happens at the plan's ceiling
A thread in the plan means one open connection to the gateway. While there are fewer connections than the limit, the gateway accepts new ones at once. When all are busy, a new connection waits briefly for a free slot and is refused if none frees up. Below: what that refusal looks like, how it differs from a site's rate limit, and what to change in your software.
In this article
What counts as a thread
A thread is an open TCP connection from your software to the gateway, not a request and not an address. A hundred requests can pass through one keep-alive connection, and it holds one thread the whole time. For HTTPS the connection starts with CONNECT and holds a thread while the tunnel is open.
The limit applies to the whole plan at once, across all connection servers. If your software uses several gateway addresses, their connections add up. A small margin on top keeps the split between servers from causing false refusals.
What happens at the ceiling
- While fewer connections than the limit are open, a new one is accepted immediately.
- When every thread is busy, a new connection waits up to a couple of seconds for a free slot. If a connection closes meanwhile, your software only sees a small delay.
- If no slot frees up, the gateway refuses. The HTTP proxy answers 429, SOCKS5 answers reply code 0x02, connection not allowed by ruleset.
HTTP/1.1 429 Too Many Requests
Retry-After: 1
Content-Type: text/plain; charset=utf-8
Connection: close
Thread limit reached: every connection your plan allows is in use. Close idle connections or upgrade the plan.Telling the gateway's 429 from a site's 429
Same code, different source. A site returns 429 when one address calls it too often: the fix is pace and pool width, covered in the article on 429 and retries. The gateway returns 429 when the plan's threads are busy: what matters there is not request rate but the number of open connections.
- With HTTPS, the gateway's answer comes to CONNECT and no tunnel opens. curl prints CONNECT tunnel failed, response 429. A site's answer arrives inside the tunnel, after TLS.
- The gateway's body says Thread limit reached. Sites don't write that.
- Over SOCKS5 a site cannot answer 0x02 at all: that reply comes from the proxy itself.
curl -sv -o /dev/null -x http://LOGIN:PASSWORD@GATEWAY:PORT https://example.com 2>&1 \
| grep -E '< HTTP|CONNECT tunnel|Thread limit'Why threads are busy with few requests
Most often threads are held not by requests but by connections that are open and idle.
- Client connection pools. requests.Session, aiohttp and httpx keep connections in reserve. A hundred workers with a pool of ten each can hold up to a thousand threads with no requests at all.
- Browsers. A page through a proxy opens several connections per host and keeps them while the tab is open.
- Hung connections. Without a read timeout, a connection to a slow site lives for minutes.
- Several programs on one plan. Their connections add up to one limit.
You can check this in the dashboard: the service page shows open connections in real time. If the number sits at the ceiling while requests are near zero, the problem is connections being held, not load.
What to set in your software
- Cap concurrent connections at the plan's threads minus a 5–10% margin. In aiohttp that's limit on TCPConnector, in httpx it's max_connections.
- Set connect and read timeouts so hung connections are released.
- If you need a new address per request, turn keep-alive off. That changes the address and stops connections piling up, see why the IP doesn't change.
- Treat a 429 from the gateway as a signal to wait: Retry-After is one second. Retry after a pause, not immediately.
import aiohttp
THREADS = 100 # threads in the plan
connector = aiohttp.TCPConnector(limit=int(THREADS * 0.9), force_close=True)
timeout = aiohttp.ClientTimeout(connect=10, sock_read=30)
async with aiohttp.ClientSession(connector=connector, timeout=timeout) as session:
...When to add threads
If connections close on time and the gateway still returns 429 during working hours, the plan simply has too few threads for the job. The number you need comes from the formula in how many threads to set in a scraper: requests per second times average response time, plus a margin for retries. Threads are added on the service page in the dashboard, and the login, password and settings stay the same.
Static packages have a different limit
Datacenter IPv4 packages work differently. A regular package allows 1,000 concurrent connections for the whole package, whatever the number of addresses. With the high concurrency option the limit is 10 × the number of IPs; the option starts at 250 addresses. Connections can be spread across addresses in any way. At the ceiling such a package answers 429 with the text Not Enough Connections.
Running out of threads?
Rotating IPv6 from 650 ₽ for 50 threads, IPv4 from 1375 ₽ for 100. Traffic is not metered, and threads are added in the dashboard without changing settings.
View pricing