Skip to content

Crashes in Python 3.14 #354

Open
Open

Description

@khteh
Traceback (most recent call last):
  File "/usr/lib/python3.14/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.14/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/asyncio/run.py", line 195, in asyncio_worker
    _run(
    ~~~~^
        partial(worker_serve, app, config, sockets=sockets),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        debug=config.debug,
        ^^^^^^^^^^^^^^^^^^^
        shutdown_trigger=shutdown_trigger,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/asyncio/run.py", line 233, in _run
    runner.run(main(shutdown_trigger=shutdown_trigger))
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/asyncio/runners.py", line 127, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/asyncio/futures.py", line 208, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/usr/lib/python3.14/asyncio/tasks.py", line 289, in __step_run_and_handle_result
    result = coro.send(None)
  File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/asyncio/run.py", line 85, in worker_serve
    await lifespan.wait_for_startup()
  File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/asyncio/lifespan.py", line 93, in wait_for_startup
    await asyncio.wait_for(self.startup.wait(), timeout=self.config.startup_timeout)
  File "/usr/lib/python3.14/asyncio/tasks.py", line 487, in wait_for
    async with timeouts.timeout(timeout):
               ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.14/asyncio/timeouts.py", line 88, in __aenter__
    raise RuntimeError("Timeout should be used inside a task")
RuntimeError: Timeout should be used inside a task
<sys>:0: RuntimeWarning: coroutine 'Event.wait' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Activity

  1. khteh commented on May 15, 2026

    @khteh
    Author

    Same thing with trio:

    /usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/task_group.py:39: RuntimeWarning: coroutine 'ASGIHTTPConnection.handle_messages' was never awaited
      await config.log.exception("Error in ASGI Framework")
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    Process SpawnProcess-1:
      + Exception Group Traceback (most recent call last):
      |   File "/usr/lib/python3.14/multiprocessing/process.py", line 320, in _bootstrap
      |     self.run()
      |     ~~~~~~~~^^
      |   File "/usr/lib/python3.14/multiprocessing/process.py", line 108, in run
      |     self._target(*self._args, **self._kwargs)
      |     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/run.py", line 138, in trio_worker
      |     trio.run(partial(worker_serve, app, config, sockets=sockets, shutdown_trigger=shutdown_trigger))
      |     ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/trio/_core/_run.py", line 2552, in run
      |     raise runner.main_task_outcome.error
      |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/run.py", line 47, in worker_serve
      |     async with trio.open_nursery() as lifespan_nursery:
      |                ~~~~~~~~~~~~~~~~~^^
      |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/trio/_core/_run.py", line 1126, in __aexit__
      |     raise combined_error_from_nursery
      | ExceptionGroup: Exceptions from Trio nursery (1 sub-exception)
      +-+---------------- 1 ----------------
        | Exception Group Traceback (most recent call last):
        |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/run.py", line 51, in worker_serve
        |     async with trio.open_nursery() as server_nursery:
        |                ~~~~~~~~~~~~~~~~~^^
        |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/trio/_core/_run.py", line 1126, in __aexit__
        |     raise combined_error_from_nursery
        | ExceptionGroup: Exceptions from Trio nursery (1 sub-exception)
        +-+---------------- 1 ----------------
          | Exception Group Traceback (most recent call last):
          |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/udp_server.py", line 37, in run
          |     async with TaskGroup() as task_group:
          |                ~~~~~~~~~^^
          |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/task_group.py", line 80, in __aexit__
          |     await self._nursery_manager.__aexit__(exc_type, exc_value, tb)
          |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/trio/_core/_run.py", line 1126, in __aexit__
          |     raise combined_error_from_nursery
          | ExceptionGroup: Exceptions from Trio nursery (1 sub-exception)
          +-+---------------- 1 ----------------
            | Traceback (most recent call last):
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/task_group.py", line 41, in _handle
            |     await send(None)
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/protocol/http_stream.py", line 139, in app_send
            |     await self._send_error_response(500)
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/protocol/http_stream.py", line 257, in _send_error_response
            |     await self.send(EndBody(stream_id=self.stream_id))
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/protocol/h3.py", line 83, in stream_send
            |     self.connection.send_data(event.stream_id, b"", True)
            |     ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/aioquic/h3/connection.py", line 557, in send_data
            |     self._quic.send_stream_data(
            |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
            |         stream_id, encode_frame(FrameType.DATA, data), end_stream
            |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            |     )
            |     ^
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/aioquic/quic/connection.py", line 1139, in send_stream_data
            |     stream.sender.write(data, end_stream=end_stream)
            |     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            |   File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/aioquic/quic/stream.py", line 334, in write
            |     assert self._reset_error_code is None, "cannot call write() after reset()"
            |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            | AssertionError: cannot call write() after reset()
            +------------------------------------
    
    2026-05-15 13:27:12 INFO     Running app...
    2026-05-15 13:27:12 INFO     Running on https://127.0.0.1:8000 (CTRL + C to quit)
    2026-05-15 13:27:12 INFO     Running on http://0.0.0.0:8080 (CTRL + C to quit)
    2026-05-15 13:27:12 INFO     Running on https://0.0.0.0:4433 (QUIC) (CTRL + C to quit)
    2026-05-15 13:27:13 INFO     Running on https://[::]:4433 (QUIC) (CTRL + C to quit)
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Network path ('::1', 34404, 0, 0) discovered
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] QuicConnectionState.FIRSTFLIGHT -> QuicConnectionState.CONNECTED
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Sending PING (probe) in packet 0
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Duplicate CRYPTO data received for epoch Epoch.INITIAL
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] Negotiated protocol version 0x00000001 (VERSION_1)
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] TLS State.SERVER_EXPECT_CLIENT_HELLO -> State.SERVER_EXPECT_FINISHED
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Received PING (probe) response
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Discarding epoch Epoch.INITIAL
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Network path ('::1', 34404, 0, 0) validated by handshake
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] TLS State.SERVER_EXPECT_FINISHED -> State.SERVER_POST_HANDSHAKE
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Discarding epoch Epoch.HANDSHAKE
    2026-05-15 13:27:45 INFO     [f968e0c9dc50f4ba] ALPN negotiated protocol h3
    2026-05-15 13:27:45 DEBUG    [f968e0c9dc50f4ba] Stream 2 created by peer
    2026-05-15 13:27:46 DEBUG    [f968e0c9dc50f4ba] Stream 10 created by peer
    2026-05-15 13:27:46 DEBUG    [f968e0c9dc50f4ba] Stream 0 created by peer
    2026-05-15 13:27:46 ERROR    Error in ASGI Framework
    Traceback (most recent call last):
      File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/trio/task_group.py", line 28, in _handle
        await app(scope, receive, send, sync_spawn, call_soon)
      File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/hypercorn/app_wrappers.py", line 34, in __call__
        await self.app(scope, receive, send)
      File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/quart/app.py", line 1735, in __call__
        await self.asgi_app(scope, receive, send)
      File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/quart/app.py", line 1761, in asgi_app
        await asgi_handler(receive, send)
      File "/usr/src/Python/PythonRestAPI/.venv/lib/python3.14/site-packages/quart/asgi.py", line 54, in __call__
        receiver_task = asyncio.ensure_future(self.handle_messages(request, receive))
      File "/usr/lib/python3.14/asyncio/tasks.py", line 730, in ensure_future
        loop = events.get_event_loop()
      File "/usr/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
        raise RuntimeError('There is no current event loop in thread %r.'
                           % threading.current_thread().name)
    RuntimeError: There is no current event loop in thread 'MainThread'.
    
  2. p1-mmr commented on May 22, 2026

    @p1-mmr

    Affects me too, it seems to be caused by the asyncio.current_task() returning nothing while it should for the asyncio runtime, and this feels weird

  3. khteh commented on Jun 13, 2026

    @khteh
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions