Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify C++ extension code by using pybind11 #3

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

aloisklink
Copy link
Contributor

@aloisklink aloisklink commented Jul 18, 2023

In PR #2, we added some initial code that allows us to write a Python module in C++, using the Python C API. However, the current C Python API is very verbose, as it's designed for use with C code. However, since we're using C++, we can use something a C++ API, such as pybind11, to simplify our code.

As you can see, it worked wonders! From src/nqm/irimager/irimager.cpp, we deleted 135 lines of code, and only added 9. More importantly, pybind11 also has some NumPy API helpers, so that we can easily return numpy arrays from our C++ code.

Edit: Sorry, forgot to mention this, but one issue with pybind11 is that it adds a pybind11 metaclass to all objects. Since we can't represent this in the typing stubs, stubtest always prints an error about this, so we need to ignore it in CI.

Use [pybind11][1] to simplify our C++ code.

The current C Python API is very verbose, as it's designed for use with
C code. However, since we're using C++, we can use something a C++ API.

[nanobind][2] is the more modern C++ Python bindling library, however,
we're **NOT** using it due to it's CMake requirement. Using CMake in a
Python extension is pretty easy if we're using [scikit-build-core][3],
but unfortuantely, `scikit-build-core` conflicts with [poetry-core][4],
which we are using for managing Python dependencies.

[1]: https://github.com/pybind/pybind11
[2]: https://github.com/wjakob/nanobind
[3]: https://github.com/scikit-build/scikit-build-core
[4]: https://github.com/python-poetry/poetry-core
Mypy's `stubtest` command is returning the following error:

```console
me@user:~$ MYPYPATH=src poetry run stubtest nqm.irimager
error: nqm.irimager.IRImager is inconsistent, metaclass differs
Stub: in file src/nqm/irimager/__init__.pyi:11
N/A
Runtime:
<class 'pybind11_builtins.pybind11_type'>
```

This is because pybind11 adds a metaclass to all classes it creates,
and in our type stubs, we can't document this metaclass since it's
internal only.

In CI, we can just ignore this error, and only fail CI if there are
other errors.
@aloisklink aloisklink force-pushed the refactor/use-pybind11 branch from 329b682 to 402ca9a Compare July 21, 2023 09:43
@aloisklink aloisklink marked this pull request as ready for review July 21, 2023 09:45
@aloisklink aloisklink requested a review from AshleySetter July 21, 2023 09:45
Copy link
Contributor

@AshleySetter AshleySetter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much nicer using pybind11, so much boilerplate code reduction!

I get the following error when I attempt to run pytest:

(base) ash@ash-XPS-13-9305:~/nqm-irimager$ poetry run pytest
================================================================================= test session starts =================================================================================
platform linux -- Python 3.9.7, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/ash/nqm-irimager, configfile: pyproject.toml
collected 0 items / 1 error                                                                                                                                                           

======================================================================================= ERRORS ========================================================================================
_______________________________________________________________________ ERROR collecting tests/test_irimager.py _______________________________________________________________________
ImportError while importing test module '/home/ash/nqm-irimager/tests/test_irimager.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_irimager.py:2: in <module>
    from nqm.irimager import IRImager
E   ImportError: /home/ash/nqm-irimager/src/nqm/irimager.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv
=============================================================================== short test summary info ===============================================================================
ERROR tests/test_irimager.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================== 1 error in 0.05s ===================================================================================

This _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv demangles to std::__exception_ptr::exception_ptr::_M_release() it seems from a cursory google that it's related to which compiler is being used; I've got gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1) and cmake version 3.22.1 installed. We may need some way to specify the compiler (or compiler version)?

@AshleySetter
Copy link
Contributor

This seems relevant: pybind/pybind11#3623

@AshleySetter
Copy link
Contributor

Seems like a toolchain compatibility issue according to this: pybind/pybind11#3623 (comment)

@aloisklink
Copy link
Contributor Author

This _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv demangles to std::__exception_ptr::exception_ptr::_M_release()

My gut feeling is that this is due to a dynamic library mismatch, e.g. you're compiling with g++ 11.3.0, but you're running with a different C++ standard library.

Can you show me the output of:

me@pc:~/nqm-irimager (nqm-irimager-2)$ ldd build/lib.linux-x86_64-cpython-310/nqm/irimager.cpython-310-x86_64-linux-gnu.so 
	linux-vdso.so.1 (0x00007fff315d7000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f49dce87000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f49dce67000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f49dcc3f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f49dcb58000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f49dd0ec000)

You can also run echo $LD_LIBRARY_PATH and see if that prints anything.

I've also got g++ 11.3.0 and it works for me (same in a new Ubuntu 20.04 container).

@AshleySetter
Copy link
Contributor

I don't have a build directory in the repo directory but:

(base) ash@ash-XPS-13-9305:~/nqm-irimager$ ldd src/nqm/irimager.cpython-39-x86_64-linux-gnu.so 
        linux-vdso.so.1 (0x00007ffd885b1000)
        libstdc++.so.6 => /home/ash/anaconda3/lib/libstdc++.so.6 (0x00007f3bf4c6e000)
        libgcc_s.so.1 => /home/ash/anaconda3/lib/libgcc_s.so.1 (0x00007f3bf4c5a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3bf4a00000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3bf4919000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3bf4e08000)

echo $LD_LIBRARY_PATH prints nothing

@aloisklink
Copy link
Contributor Author

aloisklink commented Jul 21, 2023

libstdc++.so.6 => /home/ash/anaconda3/lib/libstdc++.so.6

Ahhhh, this looks a bit suspicious. I suspect that you may be compiling with /lib/x86_64-linux-gnu/libstdc++.so.6, and if it's newer than /home/ash/anaconda3/lib/libstdc++.so.6, you're going to have problems.

Does LD_LIBRARY_PATH=/lib/x86_64-linux-gnu ldd src/nqm/irimager.cpython-39-x86_64-linux-gnu.so do anything different? If so, you can try running LD_LIBRARY_PATH=/lib/x86_64-linux-gnu poetry run pytest and see if that helps.

Edit: If you're not using Anaconda, you could also try uninstalling it and see if that helps.

@AshleySetter AshleySetter self-requested a review July 21, 2023 11:46
Copy link
Contributor

@AshleySetter AshleySetter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was me using poetry from anaconda 🤦

@aloisklink aloisklink merged commit 97bdc1e into main Jul 21, 2023
@aloisklink aloisklink deleted the refactor/use-pybind11 branch July 21, 2023 11:51
aloisklink added a commit that referenced this pull request Aug 25, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 4, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 11, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 15, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 15, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 18, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 18, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Sep 29, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Oct 16, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
aloisklink added a commit that referenced this pull request Oct 27, 2023
Potential issues, maybe calling `->stop()` on the loop after a file has
been opened, but before the `->read()` has completed, isn't defined????

Current error:

  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  (gdb) bt
  #0  0x00007ffff71403cf in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #1  0x00007ffff712e7f7 in uv_run () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #2  0x00007ffff7116d59 in ?? () from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #3  0x00007ffff7117ecb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #4  0x00007ffff7111b3d in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #5  0x00007ffff7ce2f68 in __pthread_once_slow (once_control=0x555555cf5ff8, init_routine=0x7ffff6f6fd50 <__once_proxy>) at ./nptl/pthread_once.c:116
  #6  0x00007ffff7115dd2 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<IRLoggerToSpd::impl::start_thread(std::filesystem::__cxx11::path const&)::{lambda()#1}> >, void>::_M_run() ()
     from /home/alois/Documents/nqminds/nqm-irimager/.venv/lib/python3.10/site-packages/nqm/irimager.cpython-310-x86_64-linux-gnu.so
  #7  0x00007ffff6f71253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
  #8  0x00007ffff7cddb43 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
  #9  0x00007ffff7d6fa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants