test_multiprocess_sighup and test_run[hostname] failing on macos #2766
Unanswered
observingClouds
asked this question in
Potential Issue
Replies: 1 comment 2 replies
-
I didn't create uvicorn. I just maintain it. :) Can you create a project in GitHub and show me the issue in a pipeline running on MacOS or something that I can reproduce? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋
Thanks for creating and maintaining this package. I am an upstream user of marimo and could narrow down an issue I have there down to uvicorn.
I have an Intel Mac (x86_64) and receive an (
socket.gaierror: [Errno 8] nodename nor servname provided, or not known) error when running e.g.uvx marimo edit --sandbox my_notebook.py.When running uvicorn's testsuite with
scripts/installfollowed byscripts/test, I receive the same error and bothtest_multiprocess_sighupandtest_run[hostname]are failing.Your help would be appreciated.
Cheers,
Hauke
Full traceback
❯ scripts/test + '[' -z ']' + scripts/check + ./scripts/sync-version + uv run ruff format --check --diff uvicorn tests 73 files already formatted + uv run mypy uvicorn tests Success: no issues found in 73 source files + uv run ruff check uvicorn tests All checks passed! ++ pwd + export COVERAGE_PROCESS_START=/Users/user/Documents/GitHub/uvicorn/pyproject.toml + COVERAGE_PROCESS_START=/Users/user/Documents/GitHub/uvicorn/pyproject.toml + uv run coverage run --debug config -m pytest -- config ---------------------------------------------------- branch: False command_line: None concurrency: -none- config_file: /Users/user/Documents/GitHub/uvicorn/pyproject.toml config_files_attempted: /Users/user/Documents/GitHub/uvicorn/.coveragerc /Users/user/Documents/GitHub/uvicorn/setup.cfg /Users/user/Documents/GitHub/uvicorn/tox.ini /Users/user/Documents/GitHub/uvicorn/pyproject.toml config_files_read: /Users/user/Documents/GitHub/uvicorn/pyproject.toml context: None cover_pylib: False data_file: .coverage debug: config debug_file: None disable_warnings: -none- dynamic_context: None exclude_also: -none- exclude_list: pragma: no cover pragma: nocover pragma: full coverage if TYPE_CHECKING: if typing.TYPE_CHECKING: raise NotImplementedError py-not-win32 py-not-linux py-darwin py-gte-39 py-gte-310 py-gte-311 extra_css: None fail_under: 100.0 format: None html_dir: htmlcov html_skip_covered: None html_skip_empty: None html_title: Coverage report ignore_errors: False include_namespace_packages: False json_output: coverage.json json_pretty_print: False json_show_contexts: False lcov_line_checksums: False lcov_output: coverage.lcov parallel: True partial_always_list: while (True|1|False|0): if (True|1|False|0): partial_list: #\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH) paths: {} plugin_options: {'coverage_conditional_plugin': {'omit': {"sys_platform == 'win32'": ['uvicorn/loops/uvloop.py', 'uvicorn/supervisors/multiprocess.py', 'tests/supervisors/test_multiprocess.py'], "sys_platform != 'win32'": ['uvicorn/loops/asyncio.py']}, 'rules': {'py-win32': "sys_platform == 'win32'", 'py-not-win32': "sys_platform != 'win32'", 'py-linux': "sys_platform == 'linux'", 'py-not-linux': "sys_platform != 'linux'", 'py-darwin': "sys_platform == 'darwin'", 'py-gte-39': 'sys_version_info >= (3, 9)', 'py-lt-39': 'sys_version_info < (3, 9)', 'py-gte-310': 'sys_version_info >= (3, 10)', 'py-lt-310': 'sys_version_info < (3, 10)', 'py-gte-311': 'sys_version_info >= (3, 11)', 'py-lt-311': 'sys_version_info < (3, 11)'}}} plugins: coverage_conditional_plugin precision: 2 relative_files: False report_contexts: None report_include: None report_omit: None run_include: -none- run_omit: uvicorn/workers.py uvicorn/__main__.py uvicorn/_compat.py uvicorn/loops/asyncio.py show_contexts: False show_missing: True sigterm: False skip_covered: True skip_empty: False sort: None source: None source_dirs: -none- source_pkgs: uvicorn tests timid: False xml_output: coverage.xml xml_package_depth: 99 -- end ------------------------------------------------------- =========================================== test session starts ============================================ platform darwin -- Python 3.14.1, pytest-8.3.5, pluggy-1.6.0 rootdir: /Users/user/Documents/GitHub/uvicorn configfile: pyproject.toml plugins: anyio-4.11.0, mock-3.14.0, xdist-3.6.1 8 workers [931 items] .................................................................................................... [ 10%] .................................................................................................... [ 21%] .................................................................................................... [ 32%] .................................................................................................... [ 42%] .................................................................................................... [ 53%] .................................................................................................... [ 64%] .....................................ss..................s.s.....................ss......ss......... [ 75%] ...........s...........s..ss........................................................................ [ 85%] ................................................s................................................... [ 96%] ..............FF.........s..... [100%]Task exception was never retrieved future: exception=SystemExit(1)> Traceback (most recent call last): File "/Users/user/Documents/GitHub/uvicorn/uvicorn/server.py", line 164, in startup server = await loop.create_server( ^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 1578, in create_server infos = await tasks.gather(*fs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 1509, in _create_server_getaddrinfo infos = await self._ensure_resolved((host, port), family=family, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type=socket.SOCK_STREAM, ^^^^^^^^^^^^^^^^^^^^^^^^ flags=flags, loop=self) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 1505, in _ensure_resolved return await loop.getaddrinfo(host, port, family=family, type=type, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ proto=proto, flags=flags) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 936, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ None, getaddr_func, host, port, family, type, proto, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/concurrent/futures/thread.py", line 86, in run result = ctx.run(self.task) File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/concurrent/futures/thread.py", line 73, in run return fn(*args, **kwargs) File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/socket.py", line 983, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno 8] nodename nor servname provided, or not known During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/runner.py", line 341, in from_call result: TResult | None = func() ~~~~^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/runner.py", line 242, in lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 512, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall raise exception File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall teardown.throw(exception) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_call yield from thread_exception_runtest_hook() File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/threadexception.py", line 68, in thread_exception_runtest_hook yield File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall teardown.throw(exception) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_call yield from unraisable_exception_runtest_hook() File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/unraisableexception.py", line 70, in unraisable_exception_runtest_hook yield File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall teardown.throw(exception) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/logging.py", line 846, in pytest_runtest_call yield from self._runtest_for(item, "call") File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/logging.py", line 829, in _runtest_for yield File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall teardown.throw(exception) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/capture.py", line 898, in pytest_runtest_call return (yield) ^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall teardown.throw(exception) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call return (yield) ^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall res = hook_impl.function(*args) File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call item.runtest() ~~~~~~~~~~~~^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/_pytest/python.py", line 1627, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 512, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall raise exception File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall res = hook_impl.function(*args) File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/anyio/pytest_plugin.py", line 186, in pytest_pyfunc_call runner.run_test(pyfuncitem.obj, testargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/.venv/lib/python3.14/site-packages/anyio/_backends/_asyncio.py", line 2288, in run_test self.get_loop().run_until_complete( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self._call_in_runner_task(test_func, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete self.run_forever() ~~~~~~~~~~~~~~~~^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 677, in run_forever self._run_once() ~~~~~~~~~~~~~~^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py", line 2046, in _run_once handle._run() ~~~~~~~~~~~^^ File "/Users/user/.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/events.py", line 94, in _run self._context.run(self._callback, *self._args) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/Documents/GitHub/uvicorn/uvicorn/server.py", line 71, in serve await self._serve(sockets) File "/Users/user/Documents/GitHub/uvicorn/uvicorn/server.py", line 86, in _serve await self.startup(sockets=sockets) File "/Users/user/Documents/GitHub/uvicorn/uvicorn/server.py", line 174, in startup sys.exit(1) ~~~~~~~~^^^ SystemExit: 1 ================================================= FAILURES ================================================= _________________________________________ test_multiprocess_sighup _________________________________________ [gw4] darwin -- Python 3.14.1 /Users/user/Documents/GitHub/uvicorn/.venv/bin/python @pytest.mark.skipif(not hasattr(signal, "SIGHUP"), reason="platform unsupports SIGHUP") def test_multiprocess_sighup() -> None: """ Ensure that the SIGHUP signal is handled as expected. """ config = Config(app=app, workers=2) supervisor = Multiprocess(config, target=run, sockets=[]) threading.Thread(target=supervisor.run, daemon=True).start() time.sleep(1) pids = [p.pid for p in supervisor.processes] supervisor.signal_queue.append(signal.SIGHUP) time.sleep(1) > assert pids != [p.pid for p in supervisor.processes] E assert [22311, 22312] != [22311, 22312] tests/supervisors/test_multiprocess.py:136: AssertionError ------------------------------------------- Captured stderr call ------------------------------------------- INFO: Started parent process [21860] -------------------------------------------- Captured log call --------------------------------------------- INFO uvicorn.error:multiprocess.py:147 Started parent process [21860] ____________________________________________ test_run[hostname] ____________________________________________ [gw3] darwin -- Python 3.14.1 /Users/user/Documents/GitHub/uvicorn/.venv/bin/python self = , sockets = None async def startup(self, sockets: list[socket.socket] | None = None) -> None: await self.lifespan.startup() if self.lifespan.should_exit: self.should_exit = True return config = self.config def create_protocol( _loop: asyncio.AbstractEventLoop | None = None, ) -> asyncio.Protocol: return config.http_protocol_class( # type: ignore[call-arg] config=config, server_state=self.server_state, app_state=self.lifespan.state, _loop=_loop, ) loop = asyncio.get_running_loop() listeners: Sequence[socket.SocketType] if sockets is not None: # pragma: full coverage # Explicitly passed a list of open sockets. # We use this when the server is run from a Gunicorn worker. def _share_socket( sock: socket.SocketType, ) -> socket.SocketType: # pragma py-not-win32 # Windows requires the socket be explicitly shared across # multiple workers (processes). from socket import fromshare # type: ignore[attr-defined] sock_data = sock.share(os.getpid()) # type: ignore[attr-defined] return fromshare(sock_data) self.servers: list[asyncio.base_events.Server] = [] for sock in sockets: is_windows = platform.system() == "Windows" if config.workers > 1 and is_windows: # pragma: py-not-win32 sock = _share_socket(sock) # type: ignore[assignment] server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) self.servers.append(server) listeners = sockets elif config.fd is not None: # pragma: py-win32 # Use an existing socket, from a file descriptor. sock = socket.fromfd(config.fd, socket.AF_UNIX, socket.SOCK_STREAM) server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) assert server.sockets is not None # mypy listeners = server.sockets self.servers = [server] elif config.uds is not None: # pragma: py-win32 # Create a socket using UNIX domain socket. uds_perms = 0o666 if os.path.exists(config.uds): uds_perms = os.stat(config.uds).st_mode # pragma: full coverage server = await loop.create_unix_server( create_protocol, path=config.uds, ssl=config.ssl, backlog=config.backlog ) os.chmod(config.uds, uds_perms) assert server.sockets is not None # mypy listeners = server.sockets self.servers = [server] else: # Standard case. Create a socket from a host/port pair. try: > server = await loop.create_server( create_protocol, host=config.host, port=config.port, ssl=config.ssl, backlog=config.backlog, ) uvicorn/server.py:164: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:1578: in create_server infos = await tasks.gather(*fs) ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:1509: in _create_server_getaddrinfo infos = await self._ensure_resolved((host, port), family=family, ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:1505: in _ensure_resolved return await loop.getaddrinfo(host, port, family=family, type=type, ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:936: in getaddrinfo return await self.run_in_executor( ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/concurrent/futures/thread.py:86: in run result = ctx.run(self.task) ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/concurrent/futures/thread.py:73: in run return fn(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ host = 'localhost', port = 61784, family = , type = proto = 0, flags = def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): """Resolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. """ # We override this function since we want to translate the numeric family # and socket type values to enum constants. addrlist = [] > for res in _socket.getaddrinfo(host, port, family, type, proto, flags): E socket.gaierror: [Errno 8] nodename nor servname provided, or not known ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/socket.py:983: gaierror During handling of the above exception, another exception occurred: pyfuncitem = @pytest.hookimpl(tryfirst=True) def pytest_pyfunc_call(pyfuncitem: Any) -> bool | None: def run_with_hypothesis(**kwargs: Any) -> None: with get_runner(backend_name, backend_options) as runner: runner.run_test(original_func, kwargs) backend = pyfuncitem.funcargs.get("anyio_backend") if backend: backend_name, backend_options = extract_backend_and_options(backend) if hasattr(pyfuncitem.obj, "hypothesis"): # Wrap the inner test function unless it's already wrapped original_func = pyfuncitem.obj.hypothesis.inner_test if original_func.__qualname__ != run_with_hypothesis.__qualname__: if iscoroutinefunction(original_func): pyfuncitem.obj.hypothesis.inner_test = run_with_hypothesis return None if iscoroutinefunction(pyfuncitem.obj): funcargs = pyfuncitem.funcargs testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames} with get_runner(backend_name, backend_options) as runner: try: > runner.run_test(pyfuncitem.obj, testargs) .venv/lib/python3.14/site-packages/anyio/pytest_plugin.py:186: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .venv/lib/python3.14/site-packages/anyio/_backends/_asyncio.py:2288: in run_test self.get_loop().run_until_complete( ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:706: in run_until_complete self.run_forever() ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:677: in run_forever self._run_once() ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/base_events.py:2046: in _run_once handle._run() ../../../.local/share/uv/python/cpython-3.14.1-macos-x86_64-none/lib/python3.14/asyncio/events.py:94: in _run self._context.run(self._callback, *self._args) uvicorn/server.py:71: in serve await self._serve(sockets) uvicorn/server.py:86: in _serve await self.startup(sockets=sockets) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , sockets = None async def startup(self, sockets: list[socket.socket] | None = None) -> None: await self.lifespan.startup() if self.lifespan.should_exit: self.should_exit = True return config = self.config def create_protocol( _loop: asyncio.AbstractEventLoop | None = None, ) -> asyncio.Protocol: return config.http_protocol_class( # type: ignore[call-arg] config=config, server_state=self.server_state, app_state=self.lifespan.state, _loop=_loop, ) loop = asyncio.get_running_loop() listeners: Sequence[socket.SocketType] if sockets is not None: # pragma: full coverage # Explicitly passed a list of open sockets. # We use this when the server is run from a Gunicorn worker. def _share_socket( sock: socket.SocketType, ) -> socket.SocketType: # pragma py-not-win32 # Windows requires the socket be explicitly shared across # multiple workers (processes). from socket import fromshare # type: ignore[attr-defined] sock_data = sock.share(os.getpid()) # type: ignore[attr-defined] return fromshare(sock_data) self.servers: list[asyncio.base_events.Server] = [] for sock in sockets: is_windows = platform.system() == "Windows" if config.workers > 1 and is_windows: # pragma: py-not-win32 sock = _share_socket(sock) # type: ignore[assignment] server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) self.servers.append(server) listeners = sockets elif config.fd is not None: # pragma: py-win32 # Use an existing socket, from a file descriptor. sock = socket.fromfd(config.fd, socket.AF_UNIX, socket.SOCK_STREAM) server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) assert server.sockets is not None # mypy listeners = server.sockets self.servers = [server] elif config.uds is not None: # pragma: py-win32 # Create a socket using UNIX domain socket. uds_perms = 0o666 if os.path.exists(config.uds): uds_perms = os.stat(config.uds).st_mode # pragma: full coverage server = await loop.create_unix_server( create_protocol, path=config.uds, ssl=config.ssl, backlog=config.backlog ) os.chmod(config.uds, uds_perms) assert server.sockets is not None # mypy listeners = server.sockets self.servers = [server] else: # Standard case. Create a socket from a host/port pair. try: server = await loop.create_server( create_protocol, host=config.host, port=config.port, ssl=config.ssl, backlog=config.backlog, ) except OSError as exc: logger.error(exc) await self.lifespan.shutdown() > sys.exit(1) E SystemExit: 1 uvicorn/server.py:174: SystemExit ------------------------------------------- Captured stderr call ------------------------------------------- INFO: Started server process [21854] INFO: Waiting for application startup. INFO: ASGI 'lifespan' protocol appears unsupported. INFO: Application startup complete. ERROR: [Errno 8] nodename nor servname provided, or not known -------------------------------------------- Captured log call --------------------------------------------- INFO uvicorn.error:server.py:84 Started server process [21854] INFO uvicorn.error:on.py:48 Waiting for application startup. INFO uvicorn.error:on.py:94 ASGI 'lifespan' protocol appears unsupported. INFO uvicorn.error:on.py:62 Application startup complete. ERROR uvicorn.error:server.py:172 [Errno 8] nodename nor servname provided, or not known ========================================= short test summary info ========================================== SKIPPED [2] tests/protocols/test_websocket.py:986: WebSocketsSansIOProtocol sends both start and body messages in one message. SKIPPED [2] tests/protocols/test_websocket.py:914: WebSocketsSansIOProtocol sends both start and body messages in one message. SKIPPED [1] tests/supervisors/test_reload.py:140: Flaky on Windows and MacOS SKIPPED [1] tests/supervisors/test_reload.py:156: Flaky on Windows and MacOS SKIPPED [2] tests/protocols/test_websocket.py:948: WebSocketsSansIOProtocol sends both start and body messages in one message. SKIPPED [1] tests/supervisors/test_reload.py:191: Flaky on Windows and MacOS SKIPPED [1] tests/supervisors/test_reload.py:213: Flaky on Windows and MacOS SKIPPED [1] tests/supervisors/test_reload.py:236: Flaky on Windows and MacOS SKIPPED [1] tests/supervisors/test_reload.py:258: Flaky on Windows and MacOS SKIPPED [1] tests/supervisors/test_multiprocess.py:110: platform unsupports SIGBREAK SKIPPED [1] tests/supervisors/test_reload.py:98: Flaky on Windows and MacOS ================================ 2 failed, 915 passed, 14 skipped in 50.59s ================================Beta Was this translation helpful? Give feedback.
All reactions