Random segmentation fault; multithreaded code?

Hey everybody -

I’m experiencing a random crash (report reproduced below) in my Mac OS-only app. My app uses Apple’s vimage framework to analyze bitmap images.

vimage is internally threaded to speed up its operations. I have many declares that use vimage, but only one of them seems to cause this crash, and I don’t think it’s a coincidence that the problematic call is one that is much more likely to be multithreaded due to the operation being performed and the data it is working on. Furthermore, it only fails about 25% of the time.

Is there any way to resolve this? Am I misreading the crash report?

Thanks!

[code]Process: My Application.debug [7937]
Path: /Users/USER/*/My Application.debug.app/Contents/MacOS/My Application.debug
Identifier: com.mavericklabel.vimageSandbox
Version: ??? (1.0.0.0.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: My Application.debug [7937]
User ID: 892385335

Date/Time: 2020-02-04 10:47:19.926 -0800
OS Version: Mac OS X 10.14.6 (18G3020)
Report Version: 12
Bridge OS Version: 4.2 (17P3050)
Anonymous UUID: F4831EDC-F31E-046B-CEA6-5CAD7C256C68

Sleep/Wake UUID: 5C3269C7-23AC-456D-8E4F-BB48410BED38

Time Awake Since Boot: 45000 seconds
Time Since Wake: 8900 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [7937]

VM Regions Near 0x18:
–>
__TEXT 0000000108e1e000-00000001096a5000 [ 8732K] r-x/rwx SM=COW /Users/USER/*/My Application.debug.app/Contents/MacOS/My Application.debug

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.Foundation 0x00007fff2f1407a8 -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:] + 427
1 com.apple.Foundation 0x00007fff2f140505 -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 130
2 com.apple.Foundation 0x00007fff2f1403af -[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 312
3 com.apple.Foundation 0x00007fff2f1277d8 -[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 393
4 com.apple.Foundation 0x00007fff2f1265e3 -[NSLayoutConstraint _setSymbolicConstant:constant:] + 366
5 com.apple.Foundation 0x00007fff2f12c4a3 -[NSLayoutConstraint setConstant:] + 68
6 com.apple.AppKit 0x00007fff2a54b060 -[NSWindow(NSConstraintBasedLayout) _changeWindowFrameFromConstraintsIfNecessary] + 388
7 com.apple.Foundation 0x00007fff2f12e6a7 -[NSISEngine withBehaviors:performModifications:] + 110
8 com.apple.AppKit 0x00007fff2a54ae73 -[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 214
9 com.apple.AppKit 0x00007fff2a54acd4 __NSWindowGetDisplayCycleObserverForLayout_block_invoke + 455
10 com.apple.AppKit 0x00007fff2a54a334 NSDisplayCycleObserverInvoke + 162
11 com.apple.AppKit 0x00007fff2a549eb4 NSDisplayCycleFlush + 1030
12 com.apple.QuartzCore 0x00007fff378c654d CA::Transaction::run_commit_handlers(CATransactionPhase) + 49
13 com.apple.QuartzCore 0x00007fff378c5d26 CA::Transaction::commit() + 212
14 com.apple.AppKit 0x00007fff2a54984d __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke + 274
15 com.apple.CoreFoundation 0x00007fff2ceb06d8 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
16 com.apple.CoreFoundation 0x00007fff2ceb060d __CFRunLoopDoObservers + 451
17 com.apple.CoreFoundation 0x00007fff2ce52d30 __CFRunLoopRun + 1136
18 com.apple.CoreFoundation 0x00007fff2ce5266e CFRunLoopRunSpecific + 455
19 com.apple.HIToolbox 0x00007fff2c0b11ab RunCurrentEventLoopInMode + 292
20 com.apple.HIToolbox 0x00007fff2c0b0ded ReceiveNextEventCommon + 355
21 com.apple.HIToolbox 0x00007fff2c0b0c76 _BlockUntilNextEventMatchingListInModeWithFilter + 64
22 com.apple.AppKit 0x00007fff2a44877d _DPSNextEvent + 1135
23 com.apple.AppKit 0x00007fff2a44746b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
24 XojoFramework 0x0000000109a8dc59 0x1099ae000 + 916569
25 XojoFramework 0x0000000109a8dc9d 0x1099ae000 + 916637
26 My Application.debug 0x0000000108ea0265 Application._CallFunctionWithExceptionHandling%%op + 181
27 XojoFramework 0x0000000109c19645 CallFunctionWithExceptionHandling(void (*)()) + 262
28 XojoFramework 0x0000000109a8dc06 0x1099ae000 + 916486
29 com.apple.AppKit 0x00007fff2a441588 -[NSApplication run] + 699
30 XojoFramework 0x0000000109c17a51 RuntimeRun + 42
31 My Application.debug 0x0000000108f2fec3 REALbasic._RuntimeRun + 19
32 My Application.debug 0x000000010965588e _Main + 846 (/#main:96)
33 My Application.debug 0x0000000109654b83 main + 19
34 libdyld.dylib 0x00007fff58db93d5 start + 1[/code]

Can you post the other threads? Do you still get the crash if you take out the declare?

Post the complete code that calls this too.