Skip to content

perf_test crashes on py3.13t on MacBook M4Pro #179

@cboulay

Description

@cboulay

I wasn't expecting this to work, but thought I'd give it a shot anyway.

First, I had to edit pyproject.toml to requires-python = ">=3.9" and then edit the extras numpy reqs to all be at least numpy>1.24.4 (note: not >=). Then I ran the following:

uv python pin 3.13t
uv sync --extra axisarray
PYTHON_GIL=0 uv run python -m ezmsg.util.perf_test --many-dynamic-sizes

(Error occurs with-or-without PYTHON_GIL=0)

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/path/to/ezmsg/src/ezmsg/util/perf_test.py", line 218, in <module>
    run_many_dynamic_sizes(args.duration, args.num_buffers)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/ezmsg/src/ezmsg/util/perf_test.py", line 188, in run_many_dynamic_sizes
    test_performance(duration, 2**exp, buffers)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/ezmsg/src/ezmsg/util/perf_test.py", line 183, in test_performance
    ez.run(SYSTEM=system)
    ~~~~~~^^^^^^^^^^^^^^^
  File "/path/to/ezmsg/src/ezmsg/core/backend.py", line 259, in run
    main_process.process(loop)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/path/to/ezmsg/src/ezmsg/core/backendprocess.py", line 268, in process
    asyncio.run_coroutine_threadsafe(context.revert(), loop=loop).result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/chad/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none/lib/python3.13t/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/Users/chad/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none/lib/python3.13t/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/path/to/ezmsg/src/ezmsg/core/graphcontext.py", line 114, in revert
    await future
  File "/Users/chad/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none/lib/python3.13t/asyncio/tasks.py", line 634, in _wait_for_one
    return f.result() if resolve else f
           ~~~~~~~~^^
  File "/path/to/ezmsg/src/ezmsg/core/pubclient.py", line 152, in wait_closed
    await task
  File "/path/to/ezmsg/src/ezmsg/core/pubclient.py", line 229, in _handle_subscriber
    await close_stream_writer(self._subscribers[info.id].writer)
  File "/path/to/ezmsg/src/ezmsg/core/netprotocol.py", line 126, in close_stream_writer
    await writer.wait_closed()
  File "/Users/chad/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none/lib/python3.13t/asyncio/streams.py", line 358, in wait_closed
    await self._protocol._get_close_waiter(self)
  File "/Users/chad/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none/lib/python3.13t/asyncio/selector_events.py", line 1094, in _write_sendmsg
    nbytes = self._sock.sendmsg(self._get_sendmsg_buffer())
ValueError: operation forbidden on released memoryview object

ETA: No error on vanilla Python 3.13. Max data rate was 20 GB/sec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions