The Fix
pip install urllib3==1.25
Based on closed urllib3/urllib3 issue #1396 · PR/commit linked
Production note: Watch p95/p99 latency and retry volume; timeouts can turn into retry storms and duplicate side-effects.
@@ -259,5 +259,8 @@ In chronological order:
* Add ``HTTPResponse.geturl`` method to provide ``urllib2.urlopen().geturl()`` behavior
+* Bruce Merry <http://www.brucemerry.org.za>
+ * Fix leaking exceptions when system calls are interrupted with zero timeout
+
#!/usr/bin/env python
import plop.collector
import requests
collector = plop.collector.Collector(interval=0.0001)
collector.start()
session = requests.Session()
while True:
session.get('http://localhost:631/', timeout=3)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: This fix is not applicable for non-zero timeout scenarios.\n\n
Why This Fix Works in Production
- Trigger: ... (truncated) ...
- Mechanism: The logic in _retry_on_intr bypasses EINTR handling when the timeout is zero
- Why the fix works: Addresses the issue of EINTR being returned from poll() with a zero timeout by modifying the logic in _retry_on_intr to set the deadline to 0 when the timeout is 0. (first fixed release: 1.25).
- If left unfixed, tail latency can spike under load and surface as timeouts/retries (amplifying incident impact).
Why This Breaks in Prod
- Shows up under Python 2.7.12 in real deployments (not just unit tests).
- The logic in _retry_on_intr bypasses EINTR handling when the timeout is zero
- Surfaces as: File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/requests/sessions.py", line 525, in get\n return self.request('GET', url, **kwargs)\n File…
Proof / Evidence
- GitHub issue: #1396
- Fix PR: https://github.com/urllib3/urllib3/pull/1399
- First fixed release: 1.25
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.43
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I thought our select code handled EINTR, I know there's been changes to that code recently.”
“> I thought our select code handled EINTR It does..”
“Ok, I've managed to reproduce the problem”
Failure Signature (Search String)
- ... (truncated) ...
Error Message
Stack trace
Error Message
-------------
File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/requests/sessions.py", line 525, in get\n return self.request('GET', url, **kwargs)\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/requests/sessions.py", line 512, in request\n resp = self.send(prep, **send_kwargs)\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/requests/sessions.py", line 622, in send\n r = adapter.send(request, **kwargs)\n File "/home/bmerry/work/sdp/git/katdal/katdal/chunkstore_s3.py", line 56, in send\n return super(_TimeoutHTTPAdapter, self).send(request, stream, timeout, *args, **kwargs)\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/requests/adapters.py", line 445, in send\n timeout=timeout\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 588, in urlopen\n conn = self._get_conn(timeout=pool_timeout)\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 239, in _get_conn\n if conn and is_connection_dropped(conn):\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/urllib3/util/connection.py", line 23, in is_connection_dropped\n return wait_for_read(sock, timeout=0.0)\n File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/urllib3/util/wait.py", line 146, in wait_for_read\n
... (truncated) ...
Minimal Reproduction
#!/usr/bin/env python
import plop.collector
import requests
collector = plop.collector.Collector(interval=0.0001)
collector.start()
session = requests.Session()
while True:
session.get('http://localhost:631/', timeout=3)
Environment
- Python: 2.7.12
- urllib3: 1.23
What Broke
Intermittent crashes occur during long-running requests due to EINTR errors.
Why It Broke
The logic in _retry_on_intr bypasses EINTR handling when the timeout is zero
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install urllib3==1.25
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/urllib3/urllib3/pull/1399
First fixed release: 1.25
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable for non-zero timeout scenarios.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
- Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
- Add a long-running test that repeats the failing call path and asserts stable memory.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.25 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.