Bug 1608 - Segfault when re-running an acquisition on a session w/ Rigol MSO5072 oscilloscope with LA (PLA2216)
Summary: Segfault when re-running an acquisition on a session w/ Rigol MSO5072 oscillo...
Status: CONFIRMED
Alias: None
Product: PulseView
Classification: Unclassified
Component: Other (show other bugs)
Version: unreleased development snapshot
Hardware: x86 Mac OS X
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-15 14:08 CEST by brainstorm
Modified: 2023-08-09 07:43 CEST (History)
2 users (show)



Attachments
Segfault reported on OSX Catalina (81.52 KB, text/plain)
2020-09-15 14:08 CEST, brainstorm
Details
pulseview ran from console with level 5 debug as instructed (48.92 KB, text/plain)
2020-09-15 14:41 CEST, brainstorm
Details
pulseview ran from console with level 5 debug as instructed: body of segfault reported by OSX (73.93 KB, text/plain)
2020-09-15 14:44 CEST, brainstorm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description brainstorm 2020-09-15 14:08:37 CEST
Created attachment 676 [details]
Segfault reported on OSX Catalina

Cannot reproduce easily, but I really was just re-running an acquisition :-S
Comment 1 Soeren Apel 2020-09-15 14:31:23 CEST
Hello, this is most likely a driver bug. Please run PV from a console with "pulseview -l 5" and when this happens again, copy the most recent console output (~100 lines) to a text file and attach it here.

Even better would be https://sigrok.org/wiki/Developers#GDB_Backtraces_for_PulseView
Comment 2 brainstorm 2020-09-15 14:41:17 CEST
Created attachment 681 [details]
pulseview ran from console with level 5 debug as instructed
Comment 3 brainstorm 2020-09-15 14:44:03 CEST
Created attachment 682 [details]
pulseview ran from console with level 5 debug as instructed: body of segfault reported by OSX

Now I can totally reproduce it: Just re-running the acquisition after a first run triggers this segfault.

I downloaded the nightly release from sigrok.org **today**, about 1 hour ago (just so you have a reference build where this is happening).
Comment 4 brainstorm 2020-09-20 08:59:36 CEST
Today I got this backtrace:


(...)
sr: scpi_usbtmc: USBTMC invalid bulk in header.
sr: scpi_usbtmc: USBTMC invalid bulk in header.
sr: session: Could not start rigol-ds device usbtmc/20.22 acquisition.
sr: session: Cannot remove non-existing event source 0x7f80e26c6bb0.
Notifying user of session error: "generic/unspecified error"
2020-09-20 16:57:43.444 pulseview[1604:18740886] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2f772be7 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6854a5bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2f79b3dc -[NSException raise] + 9
	3   AppKit                              0x00007fff2c999ddc -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
	4   AppKit                              0x00007fff2c981842 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
	5   AppKit                              0x00007fff2cb625a5 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
	6   AppKit                              0x00007fff2c9812b3 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
	7   AppKit                              0x00007fff2cb6255a -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
	8   AppKit                              0x00007fff2ccba1e8 -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 52
	9   libqcocoa.dylib                     0x00000001088353d5 qt_plugin_instance + 181653
	10  libqcocoa.dylib                     0x0000000108821d3d qt_plugin_instance + 102141
	11  libqcocoa.dylib                     0x000000010881b866 qt_plugin_instance + 76326
	12  libqcocoa.dylib                     0x000000010881b340 qt_plugin_instance + 75008
	13  QtGui                               0x0000000106dae7e2 _ZN14QWindowPrivate6createEby + 146
	14  QtWidgets                           0x00000001067ed703 _ZN14QWidgetPrivate6createEv + 1187
	15  QtWidgets                           0x00000001067ec358 _ZN7QWidget6createEybb + 328
	16  QtWidgets                           0x00000001067fed8c _ZN14QWidgetPrivate10setVisibleEb + 428
	17  QtWidgets                           0x00000001069c5662 _ZN7QDialog10setVisibleEb + 258
	18  QtWidgets                           0x00000001069c4ed3 _ZN7QDialog4execEv + 243
	19  pulseview                           0x00000001058379fd _ZN2pv10MainWindow18show_session_errorE7QStringS1_ + 333
	20  pulseview                           0x000000010583d69a _ZNSt3__110__function6__funcIZN2pv10MainWindow19on_run_stop_clickedEvE3$_1NS_9allocatorIS4_EEFv7QStringEEclEOS7_ + 74
	21  pulseview                           0x000000010584b8ae _ZN2pv7Session18sample_thread_procENSt3__18functionIFv7QStringEEE + 1950
	22  pulseview                           0x0000000105850298 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN2pv7SessionEFvNS_8functionIFv7QStringEEEEPS8_SC_EEEEEPvSH_ + 152
	23  libsystem_pthread.dylib             0x00007fff698f6109 _pthread_start + 148
	24  libsystem_pthread.dylib             0x00007fff698f1b8b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
Comment 5 Soeren Apel 2020-10-16 23:46:10 CEST
Wanted to re-visit this bug and realized I forgot to ask the version of PV you're running. Can you please give it?

I fixed segfaults in this very class (LogicSegment) about 10 days before you filed this bug, so it could be that you may have used a version that doesn't contain these fixes yet.

With that, it may also make sense to re-test with a current nightly.
Comment 6 brainstorm 2020-10-18 10:28:38 CEST
Hello,

I'm running PV 0.5.0-git-4788af1 (that's from 17th September 2020, I'll give it a go w/ nightly now...). I figured out a way to reliably trigger this:

1) Open PulseView.
2) Let it detect or select rigol-ds via USB.
3) Do an adquisition, do work, etc...
4) Power cycle the oscilloscope.
5) Click Run (acquire) on the still running PV instance.


Following those steps it crashes reliably for me. Comparing commits from 17th September up to HEAD, it doesn't seem that the USBTMC part is touched in any way, so I suspect this might trigger again?:

https://github.com/sigrokproject/pulseview/compare/4788af1e3e48461cc60d1fc035e5de64e914c03d...HEAD


I'll compile HEAD and try to reproduce in any case ;)
Comment 7 brainstorm 2020-10-18 10:43:59 CEST
Indeed, it crashes on HEAD (nightly) as well:

sr: scpi_usbtmc: USBTMC bulk out transfer error: LIBUSB_ERROR_NO_DEVICE.
sr: session: Could not start rigol-ds device usbtmc/20.23 acquisition.
sr: session: Cannot remove non-existing event source 0x7fbe1b4aabb0.

I guess that forcing a re-enumeration of the USB connected devices on the event sources right before acquiring might prevent this crash?... or actually catching that exception somehow and recovering by re-enumerating and defaulting to "no source" (error message?) if nothing is found?
Comment 8 Rock12 2023-08-09 07:43:39 CEST
"I just got my new mattress topper from MattressTopperBuddy and my sleep has never been better!" https://mattresstopperbuddy.com/best-mattress-topper-for-back-pain-side-sleepers/