Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

socketserver.Unix*Server may attempt to setSO_REUSEPORT on Unix sockets, causingEOPNOTSUPP, e.g. intest_asyncio #128916

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@mgorny

Description

@mgorny

Bug report

Bug description:

Whensocketserver.Unix*Server.server_bind() is called withallow_reuse_port attribute set toTrue, it attempts to callself.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) on a Unix socket, and it fails with:OSError: [Errno 95] Operation not supported. In particular, this happens intest_asyncio tests.

This seems to be a recent change on my system (probably in Linux kernel), as the relevant tests used to pass when I tested CPython 3.14.0a3, and now the same version failed. Now I'm at 6.12.9, back then it was 6.12.5 (but I don't think there's a point in actually verifying that).

Output from `test_asyncio.test_sock_lowlevel`
$ ./python -E  -m test -v test_asyncio.test_sock_lowlevel== CPython 3.14.0a4+ (heads/main:3193cb5ef87, Jan 16 2025, 13:54:51) [GCC 14.2.1 20241221]== Linux-6.12.9-gentoo-dist-x86_64-AMD_Ryzen_5_3600_6-Core_Processor-with-glibc2.40 little-endian== Python build: release== cwd: /home/mgorny/git/cpython/build/test_python_worker_532605æ== CPU count: 12== encodings: locale=UTF-8 FS=utf-8== resources: all test resources are disabled, use -u option to unskip testsUsing random seed: 38317947870:00:00 load avg: 0.54 Run 1 test sequentially in a single process0:00:00 load avg: 0.54 [1/1] test_asyncio.test_sock_lowleveltest_cancel_sock_accept (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_cancel_sock_accept) ... oktest_create_connection_sock (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_create_connection_sock) ... oktest_huge_content (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_huge_content) ... oktest_huge_content_recvinto (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_huge_content_recvinto) ... oktest_recvfrom (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_recvfrom) ... oktest_recvfrom_into (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_recvfrom_into) ... oktest_sendto_blocking (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sendto_blocking) ... oktest_sock_accept (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sock_accept) ... oktest_sock_client_connect_racing (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sock_client_connect_racing) ... oktest_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sock_client_fail) ... oktest_sock_client_ops (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sock_client_ops) ... oktest_sock_client_racing (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_sock_client_racing) ... oktest_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_unix_sock_client_ops) ... ERRORtest_cancel_sock_accept (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_cancel_sock_accept) ... oktest_create_connection_sock (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_create_connection_sock) ... oktest_huge_content (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_huge_content) ... oktest_huge_content_recvinto (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_huge_content_recvinto) ... oktest_recvfrom (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_recvfrom) ... oktest_recvfrom_into (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_recvfrom_into) ... oktest_sendto_blocking (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sendto_blocking) ... oktest_sock_accept (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sock_accept) ... oktest_sock_client_connect_racing (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sock_client_connect_racing) ... oktest_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sock_client_fail) ... oktest_sock_client_ops (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sock_client_ops) ... oktest_sock_client_racing (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_sock_client_racing) ... oktest_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_unix_sock_client_ops) ... ERRORtest_cancel_sock_accept (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_cancel_sock_accept) ... oktest_create_connection_sock (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_create_connection_sock) ... oktest_huge_content (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_huge_content) ... oktest_huge_content_recvinto (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_huge_content_recvinto) ... oktest_recvfrom (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_recvfrom) ... oktest_recvfrom_into (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_recvfrom_into) ... oktest_sendto_blocking (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sendto_blocking) ... oktest_sock_accept (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sock_accept) ... oktest_sock_client_connect_racing (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sock_client_connect_racing) ... oktest_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sock_client_fail) ... oktest_sock_client_ops (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sock_client_ops) ... oktest_sock_client_racing (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_sock_client_racing) ... oktest_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_unix_sock_client_ops) ... ERROR======================================================================ERROR:test_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests.test_unix_sock_client_ops)----------------------------------------------------------------------Traceback (most recent call last):  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/test_sock_lowlevel.py", line462, intest_unix_sock_client_opswith test_utils.run_test_unix_server()as httpd:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/contextlib.py", line141, in__enter__returnnext(self.gen)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line261, inrun_test_unix_serveryield from _run_test_server(address=path,use_ssl=use_ssl,                                server_cls=SilentUnixWSGIServer,                                server_ssl_cls=UnixSSLWSGIServer)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line188, in_run_test_server    httpd= server_class(address, SilentWSGIRequestHandler)  File"/home/mgorny/git/cpython/Lib/socketserver.py", line457, in__init__self.server_bind()~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line217, inserver_bind    UnixHTTPServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line207, inserver_bind    socketserver.UnixStreamServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/socketserver.py", line472, inserver_bindself.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT,1)~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OSError:[Errno 95] Operation not supported======================================================================ERROR:test_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests.test_unix_sock_client_ops)----------------------------------------------------------------------Traceback (most recent call last):  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/test_sock_lowlevel.py", line462, intest_unix_sock_client_opswith test_utils.run_test_unix_server()as httpd:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/contextlib.py", line141, in__enter__returnnext(self.gen)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line261, inrun_test_unix_serveryield from _run_test_server(address=path,use_ssl=use_ssl,                                server_cls=SilentUnixWSGIServer,                                server_ssl_cls=UnixSSLWSGIServer)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line188, in_run_test_server    httpd= server_class(address, SilentWSGIRequestHandler)  File"/home/mgorny/git/cpython/Lib/socketserver.py", line457, in__init__self.server_bind()~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line217, inserver_bind    UnixHTTPServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line207, inserver_bind    socketserver.UnixStreamServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/socketserver.py", line472, inserver_bindself.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT,1)~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OSError:[Errno 95] Operation not supported======================================================================ERROR:test_unix_sock_client_ops (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests.test_unix_sock_client_ops)----------------------------------------------------------------------Traceback (most recent call last):  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/test_sock_lowlevel.py", line462, intest_unix_sock_client_opswith test_utils.run_test_unix_server()as httpd:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/contextlib.py", line141, in__enter__returnnext(self.gen)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line261, inrun_test_unix_serveryield from _run_test_server(address=path,use_ssl=use_ssl,                                server_cls=SilentUnixWSGIServer,                                server_ssl_cls=UnixSSLWSGIServer)  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line188, in_run_test_server    httpd= server_class(address, SilentWSGIRequestHandler)  File"/home/mgorny/git/cpython/Lib/socketserver.py", line457, in__init__self.server_bind()~~~~~~~~~~~~~~~~^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line217, inserver_bind    UnixHTTPServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/test/test_asyncio/utils.py", line207, inserver_bind    socketserver.UnixStreamServer.server_bind(self)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File"/home/mgorny/git/cpython/Lib/socketserver.py", line472, inserver_bindself.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT,1)~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^OSError:[Errno 95] Operation not supported----------------------------------------------------------------------Ran 39 tests in 1.296sFAILED (errors=3)test test_asyncio.test_sock_lowlevel failedtest_asyncio.test_sock_lowlevel failed (3 errors)== Tests result: FAILURE ==1 test failed:    test_asyncio.test_sock_lowlevelTotal duration: 1.4 secTotal tests: run=39Total test files: run=1/1 failed=1Result:FAILURE

Bisect points to192d17c:

commit 192d17c3fd9945104bc0303cf248bb0d074d260eAuthor:     Idan Kapustian <71190257+idankap@users.noreply.github.com>AuthorDate: 2024-06-16 14:15:03 +0200Commit:     GitHub <noreply@github.com>CommitDate: 2024-06-16 14:15:03 +0200    gh-120485: Add an override of `allow_reuse_port` on classes subclassing `socketserver.TCPServer` (GH-120488)        Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp