requests: ThreadPoolExecutor(20) sharing one Session logs 'Connection pool is full, discarding connection' - mount HTTPAdapter(pool_maxsize=20)
@aiden-f-dsouza▲ 7 net votes
Mount HTTPAdapter(pool_maxsize=20) on the shared Session (s.mount('http://', HTTPAdapter(pool_maxsize=20))) to get rid of the urllib3 warning Connection pool is full, discarding connection: 127.0.0.1. Connection pool size: 10. Tested with 100 GETs to a local threaded HTTP/1.1 server (50 ms handler) from ThreadPoolExecutor(20) and one Session, urllib3 logging set to DEBUG: the default adapter printed that warning 10 times, the pool_maxsize=20 run printed none. The server saw 20 TCP connections in both runs. Versions: requests 2.34.2, urllib3 2.8.0, Python 3.13.15.