Working example (add the uart PD, PDv2 API as of today): pulseview -i uart/hello_world/8n1(hello_world_8n1_115200.sr I'm able to press the Run button in PV many times in a row, no crashes. Non-working example (add the i2c PD, PDv3 API): pulseview -i i2c/eeprom_24xx/atmel_at24c128/lcsoft-mini-board-fx2-init.sr There's no crash when the decoder is added and runs the first time. I can also press "Run" in PV once or twice and it won't crash, but eventually (third or fourth time I click "Run") it will crash. (this may or may not related to some further pending issues similar to #876) Backtrace: (gdb) bt #0 0x00007f4266c5f8c0 in QPen::QPen(Qt::PenStyle) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 #1 0x000055e03244434f in pv::views::TraceView::Trace::paint_back (this=0x55e033a79ad0, p=..., pp=...) at /home/uwe/code/SIGROK/pulseview/pv/view/trace.cpp:164 #2 0x000055e032463b78 in pv::views::TraceView::Viewport::paintEvent (this=0x55e033a46560) at /home/uwe/code/SIGROK/pulseview/pv/view/viewport.cpp:180 #3 0x00007f4266fb0278 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #4 0x00007f4266f68b8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #5 0x00007f4266f70341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #6 0x000055e0323d663b in Application::notify (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at /home/uwe/code/SIGROK/pulseview/pv/application.cpp:37 #7 0x00007f426667d9e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #8 0x00007f4266fa8fda in QWidgetPrivate::sendPaintEvent(QRegion const&) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #9 0x00007f4266fa9646 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007f4266faa34c in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #11 0x00007f4266fa91a4 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #12 0x00007f4266faa34c in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #13 0x00007f4266faa239 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 [...] #26 0x00007f4266faa34c in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #27 0x00007f4266fa91a4 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #28 0x00007f4266f78f8a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #29 0x00007f4266f79147 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #30 0x00007f4266f97f8f in QWidgetPrivate::syncBackingStore() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #31 0x00007f4266fb0348 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #32 0x00007f42670af92b in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #33 0x00007f4266f68b8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #34 0x00007f4266f70341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #35 0x000055e0323d663b in Application::notify (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at /home/uwe/code/SIGROK/pulseview/pv/application.cpp:37 #36 0x00007f426667d9e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #37 0x00007f426668016d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #38 0x00007f42666d1c43 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #39 0x00007f42674c17f7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #40 0x00007f42674c1a60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #41 0x00007f42674c1b0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 ---Type <return> to continue, or q <return> to quit--- #42 0x00007f42666d204f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #43 0x00007f426667b9ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #44 0x00007f426668413c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #45 0x000055e0323d39f7 in main (argc=<optimized out>, argv=<optimized out>) at /home/uwe/code/SIGROK/pulseview/main.cpp:183 Log (-l 5): srd: Created session 4. srd: Creating new i2c instance. srd: Created new i2c instance with ID i2c-1. srd: Setting channels for instance i2c-1 with list of 2 channels. srd: Setting channel mapping: sda (index 1) = channel 0. srd: Setting channel mapping: scl (index 0) = channel 1. srd: Final channel map: srd: - index 0 = channel 1 (required) srd: - index 1 = channel 0 (required) srd: Setting session 4 samplerate to 8000000. srd: Registering new callback for output type 0. srd: Calling start() on all instances in session 4. srd: Calling start() method on protocol decoder instance i2c-1. srd: Instance i2c-1 creating new output type 1 for i2c-1. srd: Instance i2c-1 creating new output type 0 for i2c-1. srd: Instance i2c-1 creating new output type 2 for i2c-1. srd: Instance i2c-1 creating new output type 3 for i2c-1. srd: Initial pins: 1, 1. srd: Decoding: abs start sample 0, abs end sample 4096 (4096 samples, 4096 bytes, unitsize = 1), instance i2c-1. srd: NULL/empty condition list, automatic match. srd: put(): self instance not found. srd: SystemError: Protocol decoder instance i2c-1: : <built-in method put of Decoder object at 0x7f4258ac8940> returned NULL without setting an error srd: Done, handled all samples (abs cur 4096 / abs end 4096). sr: [00:10.813845] session: bus: Received SR_DF_LOGIC packet (475712 bytes, unitsize = 1). srd: ['Traceback (most recent call last):\n', ' File "/home/uwe/sr/share/libsigrokdecode/decoders/i2c/pd.py", line 266, in decode\n self.handle_start(self.wait({0: \'h\', 1: \'f\'}))\n', ' File "/home/uwe/sr/share/libsigrokdecode/decoders/i2c/pd.py", line 151, in handle_start\n self.putp([cmd, None])\n', ' File "/home/uwe/sr/share/libsigrokdecode/decoders/i2c/pd.py", line 141, in putp\n self.put(self.ss, self.es, self.out_python, data)\n', 'SystemError: <built-in method put of Decoder object at 0x7f4258ac8940> returned NULL without setting an error\n'] srd: Decoding: abs start sample 4096, abs end sample 8192 (4096 samples, 4096 bytes, unitsize = 1), instance i2c-1. srd: Done, handled all samples (abs cur 8192 / abs end 8192). QObject::~QObject: Timers cannot be stopped from another thread
Created attachment 279 [details] gdb log
*** Bug 906 has been marked as a duplicate of this bug. ***
This is really annoying bug. I can confirm that reverting commit "Convert to PD API version 3" workarounds the problem for SWD PD.
This will be fixed very soon, there's a work-in-progress patch by gsi_ that seems to work for most cases in that it prevents the crashes. There are some remaining problems with sigrok-test and also with only every second run decoding, hence it's not merged just yet (but will be soonish). http://repo.or.cz/libsigrokdecode/gsi.git/commitdiff/bf7a7312661cabbd6ec4ef513f44971e825252bd Please let us know if it prevents the crashes for you as well (it does for me).
Thanks for pointing me to right commit. I tested bf7a7312661cabbd6ec4ef513f44971e825252bd with SWD PD. It solves crashes, no decoder threads are left waiting. Unfortunately decode session fails every other capture run. Might be a problem in SWD PD? Here is part of -l 4 log: =====ok====== srd: Created session 5. srd: Creating new swd instance. srd: Created new swd instance with ID swd-1. srd: Setting channels for instance swd-1 with list of 2 channels. srd: Setting channel mapping: swdio (index 1) = channel 2. srd: Setting channel mapping: swclk (index 0) = channel 1. srd: Final channel map: srd: - index 0 = channel 1 (required) srd: - index 1 = channel 2 (required) srd: Setting session 5 samplerate to 20000000. srd: Registering new callback for output type 0. srd: Calling start() on all instances in session 5. srd: Calling start() method on protocol decoder instance swd-1. srd: Instance swd-1 creating new output type 0 for swd-1. srd: Instance swd-1 creating new output type 1 for swd-1. srd: Initial pins: all 0 (self.initial_pins not set). srd: Decoding: abs start sample 0, abs end sample 20000 (20000 samples, 20000 bytes, unitsize = 1), instance swd-1. srd: No worker thread for this decoder stack exists yet, creating one: swd-1. srd: Starting thread routine for decoder swd-1 srd: Calling decoder's decode() method swd-1 srd: Done, handled all samples (abs cur 20000 / abs end 20000). srd: Freeing instance swd-1 srd: Joining decoder thread swd-1 srd: Raising 'want term', sending 'got new', for instance swd-1 srd: Running join() for instance swd-1 srd: DBG: Decoder_wait(), inst swd-1, will return from .wait(). srd: Decoder's decode() method terminated swd-1 srd: Decoder thread done (not res, want term) swd-1 srd: Call to join() done for instance swd-1 srd: Resetting decoder state swd-1 srd: Releasing initial pin state swd-1 srd: Destroyed session 5. =====failed===== srd: Created session 6. srd: Creating new swd instance. srd: SystemError: Failed to create swd instance: PyEval_EvalFrameEx returned a result with an error set srd: Destroyed session 6. ================ built on Ubuntu 16.04.2 LTS, used Python 3.5.2
Ah, yes, you wrote about "problems with ... only every second run decoding" so you know. Sorry for the noise :-)
*** Bug 887 has been marked as a duplicate of this bug. ***
*** Bug 914 has been marked as a duplicate of this bug. ***
This was fixed in 04383ea876df72b7bd5c19854c30c81abdc0aa0c, thanks a lot!