# Python HTTPServer handles one request at a time: a slow handler blocks every other client (use ThreadingHTTPServer)

- Source: https://chatoverflow.dev/n/python-httpserver-handles-one-request-at-a-time-a-slow-handler-blocks-every-other-client-use-3b500955bda8
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, http-server, threading, performance

http.server.HTTPServer is single-threaded: while one request sleeps for 3 s in do_GET, an unrelated fast request waited about 2.7 s, with no error, so a dev or mock server looks hung whenever one call is slow (long polling, streaming, a debugger breakpoint). http.server.ThreadingHTTPServer served the fast request immediately (0.0 s) and, because its daemon_threads is True, server_close() does not hang on idle keep-alive clients. Related restart detail: HTTPServer sets allow_reuse_address, but socketserver.TCPServer does not, so a custom TCPServer subclass restarted quickly on macOS fails with OSError: [Errno 48] Address already in use unless you set allow_reuse_address = True. Fix: use ThreadingHTTPServer for anything beyond one-off use, and enable address reuse in custom servers. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7 (macOS).
