Hi James, Just a further suggestion to those above about things that trigger segfaults. Ensure you don't access (and particularly modify) any Qt objects such as UI elements etc from outside the main Qt event loop thread. That is, if you have some native python threading.Thread doing data updates or something in the background, don't attempt to change UI element values or do a pyqtgraph plot.setData() call from inside the thread. Instead, set up an appropriate "update_needed" QSignal and emit that from inside the python thread, and from your Qt UI thread use update_needed.connect(handler_function) to let the work happen from inside the Qt event loop.
Patrick On Friday, 8 July 2022 at 2:01:59 am UTC+9:30 [email protected] wrote: > Hi James, > > Troubleshooting an intermittent segfault can be summarized as an exercise > in frustration, causes can be all over the place, but it can be really > tough. One thing you can do is enable the python faulthandler > <https://docs.python.org/3/library/faulthandler.html>. This may help > with identifying where in the code things are blowing up (but that's not > necessarily a guarantee that that is where the issue is). > > If you are unable to reproduce the issue with any reliability (which I > maintain doing this is a critical step and effort should be made to attempt > to do this), and migrating to a different binding is feasible, I would > recommend doing that. That's no guarantee to fix the issue though. > > Some other frequent causes of segfaults can involve the python garbage > collection cleaning up an object that may have some kind of internal Qt > reference. These can sometimes occur when using the `del` operator or > calling `gc.collect()`. > > Here is a link > <https://github.com/pyqtgraph/pyqtgraph/pulls?q=is%3Apr+is%3Aclosed+segfault>to > > closed PRs with the word "segfault" in there. Not all these PRs addressed a > segfault, but you can see what changes were made to fix some segfaults. > > Hope that helps, > Ogi > > On Thu, Jul 7, 2022 at 8:16 AM James Campbell <[email protected]> > wrote: > >> I'm using pyqtgraph in a PyQt5 app. I have a tabbed window (outside the >> main window) where each tab has a figure. Sometimes, when resizing a the >> window displaying a figure, I'll randomly get a segfault crash. This >> happens infrequently, and usually I dont run uinto this error. >> >> The annoying thing is that these segfaults are not reproducible as far as >> I can tell. >> >> Does anyone have any good advice on how one goes about debugging such >> issues? Are there well known issues that may cause such sporadic crashes? >> >> I was considering updating my app to PyQt6 to see if that will help >> things. Is PyQt6 more stable in this regard? >> >> Thanks >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pyqtgraph" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pyqtgraph/9b54d993-934a-4719-aa61-d9869a4c3a03n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/pyqtgraph/9b54d993-934a-4719-aa61-d9869a4c3a03n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/b2ab7dc6-01a8-42d2-834d-a0e566473205n%40googlegroups.com.
