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

Tests with tests ubuntu-latest, python 3.11 and pyside6 always fails #27

Open
malik-irain opened this issue Dec 6, 2024 · 4 comments
Open
Assignees

Comments

@malik-irain
Copy link
Contributor

This combination always fails in github actions.

@malik-irain malik-irain self-assigned this Dec 6, 2024
@seb5g
Copy link
Contributor

seb5g commented Dec 6, 2024

I'm sure you'll find why ;-)

@malik-irain
Copy link
Contributor Author

It actually doesn't always fail as I couldn't reproduce locally and on some runs in github actions the tests pass. So, it "randomly" (= multithread) segfaults while garbage collecting:

Fatal Python error: Segmentation fault

Thread 0x00007f94d21ff640 (most recent call first):
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/execnet/gateway_base.py", line 534 in read
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/execnet/gateway_base.py", line 567 in from_io
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/execnet/gateway_base.py", line 1160 in _thread_receiver
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/execnet/gateway_base.py", line 341 in run
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/execnet/gateway_base.py", line 411 in _perform_spawn

Current thread 0x00007f94d3892b80 (most recent call first):
  Garbage-collecting
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/GraphicsObject.py", line 20 in itemChange
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/enum.py", line 1257 in value
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/enum.py", line 211 in __get__
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/GraphicsObject.py", line 20 in itemChange
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/GraphicsObject.py", line 15 in __init__
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/UIGraphicsItem.py", line 28 in __init__
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/ROI.py", line 1359 in __init__
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/ROI.py", line 618 in addHandle
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyqtgraph/graphicsItems/ROI.py", line 559 in addRotateHandle
  File "/home/runner/work/pymodaq_gui/pymodaq_gui/src/pymodaq_gui/managers/roi_manager.py", line 304 in __init__
  File "/home/runner/work/pymodaq_gui/pymodaq_gui/tests/plotting_test/utils/plot_utils_test.py", line 133 in test_get_repr

From what I saw in the code, nothing special is happening at the crash point.

One way to solve it could be to avoid cyclic references, as stated on an old pyqtgraph issue, but more likely there are more general thread-safety problems.

@seb5g
Copy link
Contributor

seb5g commented Dec 13, 2024

in the issue you mentioned, it's more likely related to C++ objects being removed while an instance of the python object is still around. Maybe explicitly deleting things like windows and main widgets could help...

@malik-irain
Copy link
Contributor Author

Yes, but it shouldn't happen, so my guess is that it's more probable that we do something wrong (circular references + multithreading / something else ...) than the libraries do.

I'm not sure about explicit delete, it could mitigate the problem but not really solve it. Also, in practice the del keyword only remove the reference and not the object itself, leaving the object ready to be garbage collected later on when it's reference count reach 0 (which is not an info that we have). Then, to delete the objects we would have to call gc.collect() regularly, which is considered a bad practice.

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

No branches or pull requests

2 participants