artfwo / aalink

Async Python interface for Ableton Link

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terminate called without an active exception

artfwo opened this issue · comments

After migrating from pybind11 to nanobind, this can happen when exiting aalink scripts, as the scheduler thread isn't always joined properly:

Traceback (most recent call last):
  File "/home/art/aalink/build/./test.py", line 25, in <module>
    asyncio.run(main())
  File "/usr/lib64/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/runners.py", line 123, in run
    raise KeyboardInterrupt()
KeyboardInterrupt
terminate called without an active exception
Aborted (core dumped)

Detaching the thread instead of joining might lead to more segfaults, so the best solution here is probably resolving any potential cyclic dependencies to ensure that Scheduler destructor is invoked when link is deleted.

See https://nanobind.readthedocs.io/en/latest/typeslots.html for some docs on resolving cyclic references.

To reproduce consisently, build in debug mode and increase the sleep timeout in scheduler thread to 100-500ms.