https://github.com/python/cpython/commit/92f85ff3a07335e32a0e00a55b7b6aaf3657019b
commit: 92f85ff3a07335e32a0e00a55b7b6aaf3657019b
branch: main
author: Sahil Shah <[email protected]>
committer: gpshead <[email protected]>
date: 2025-05-19T19:28:09Z
summary:
gh-80184: Set getattr(socket, "SOMAXCONN", 5) as the default queue size for
TCPServer (GH-134249)
socketserver.TCPServer default queue size becomes SOMAXCONN instead of 5 when
possible.
files:
A Misc/NEWS.d/next/Library/2025-05-19-17-27-21.gh-issue-80184.LOkbaw.rst
M Doc/library/socketserver.rst
M Lib/socketserver.py
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index 59cfa136a3b7da..753f12460b824b 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -24,6 +24,8 @@ There are four basic concrete server classes:
:meth:`~BaseServer.server_activate`. The other parameters are passed to
the :class:`BaseServer` base class.
+ .. versionchanged:: next
+ The default queue size is now ``socket.SOMAXCONN`` for
:class:`socketserver.TCPServer`.
.. class:: UDPServer(server_address, RequestHandlerClass,
bind_and_activate=True)
diff --git a/Lib/socketserver.py b/Lib/socketserver.py
index 35b2723de3babe..93b0a23be27f68 100644
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -441,7 +441,7 @@ class TCPServer(BaseServer):
socket_type = socket.SOCK_STREAM
- request_queue_size = 5
+ request_queue_size = getattr(socket, "SOMAXCONN", 5)
allow_reuse_address = False
diff --git
a/Misc/NEWS.d/next/Library/2025-05-19-17-27-21.gh-issue-80184.LOkbaw.rst
b/Misc/NEWS.d/next/Library/2025-05-19-17-27-21.gh-issue-80184.LOkbaw.rst
new file mode 100644
index 00000000000000..089268dc4c3e7b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-05-19-17-27-21.gh-issue-80184.LOkbaw.rst
@@ -0,0 +1 @@
+The default queue size is now ``socket.SOMAXCONN`` for
:class:`socketserver.TCPServer`.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]