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
Crash in Qt / PySide2 / pyqtgraph #69
Comments
I spent the day investigating this issue under Win10 x64. I have found a very easy way to duplicate this crash. While in the Waveform View, continuously drag the bottom right window corner to resize the window. This causes Qt to do many redraws which seems to accelerate the crash rate. Note that the Multimeter view crashes, too. I even hacked the code to remove all pyqtgraph (all widgets but control) with no Joulescope plugged in, and observed the same crash. After much trial and error, I am now convinced that the problem is PySide 5.14.x. I can go all the way back to Joulescope UI 0.6.10 with Python 3.8.2 and PySide 5.14.2, and I see this crash. If I then convert to Python 3.7.6 and PySide2 5.13.2, no more crashes. Going back to Joulescope & Joulescope UI dev also does not crash. However, upgrading to PySide2 5.14.2 (still Python 3.7.6) results in crashes. Back on Python 3.8.2 and PySide, 5.14.2, I created a minimal window example
Dragging to resize works just fine, with no crashes. I need to figure out the gap between this minimal example and the Joulescope UI. |
I came across this presentation: Also qtutils: I modified pyjoulescope_ui MainWindow to perform this resynchronization using a Python queue which then emits a Qt event, in the same way as qtutils. Still crashes. I was also concerned that the use of numpy.float32/64 instead of Python float was causing some issues at the API level. I cleaned up both pyjoulescope and pyjoulescope_ui. I think that things may be slightly more stable, but still crashes easily on resize. Python 3.7.6 with PySide2 5.13.2 still works great. |
This commit applies to #71, #69, #67. Looking at the history of Qt and PySide2, threading issues are common defects. To minimize the chance of encountering these defects, this commit removes all thread synchronization responsibility from Qt/PySide2. The code now explicitly performs its own resynchronization. * Attempt to avoid any latent PYSIDE-810 and PYSIDE-813 style issues. * Manually resynchronize all events to the Qt main thread. * Prevent Python data from traveling across threads in Qt events.
I tried PySide2 5.14.2.1 (released Apr 24, 3 days ago), and the crash seems to be gone! This new version fixes two threading issues: See the release notes. |
I am not sure if it is intended, but in requirements.txt, it still specifies PySide2==5.13.2 instead of PySide2==5.14.2.1. |
Thanks for the comment @fusedFET. We have not yet fully tested or updated to PySide2 5.14.2.1 and Python 3.8, but we will likely make the leap in the next release. At that time, the Joulescope UI will support: Python 3.8 with PySide2 5.14.2.1+ We will update requirements.txt, setup.py, and README.md (thanks!) at that time. If you are already running with Python 3.8 and PySide2 5.14.2.1, I would appreciate it if you would let me know how it's working for you! |
Great! |
This issue now appears to be resolved due to the following changes:
|
Fixed in 0.8.16 which uses PySide 5.15.0 and Python 3.8.3. |
Version: 0.8.9
Platform: Win10 x64
Description
After a session with several recordings (of downsampled 200 Hz data?), started a recording. About an hour later, the Joulescope UI crashed. Here is the log file:
I investigated the pyqtgraph functions.py. The function is certainly unusual, but appears to respect the memory bounds. However, arr (the underlying numpy array) appears to go out of scope along with byteview, even though the QByteArray is returned. This could be the problem.
The text was updated successfully, but these errors were encountered: