App crash on Ventura

Hi there,

This is about an app running on macOS Mojave thru Monterey without issues and crashing on Ventura.
The app is signed and notarized using AppWrapper 4.
A customer upgraded his MacBook (M1) from Monterey to Ventura 13.0, now the app is crashing without raising an unhandled exception.

Environment:

Development

  • iMacPro macOS Monterey 12.4 (21F79)
  • using Xojo 2021r3.1
  • extra plugins: MBS 215, Einhugur, Chilkat, AppKit Ohanaware

Running app signed and notarized on

  • macOS Mojave up to Monterey (M1 and Intel), OK
  • macOS Ventura 13.0 (M1 and Intel), CRASH

I did a test using

  • Xojo 2022.r3.1
  • MBS upgraded to 224, last version

Same results, running (debug) on

  • macOS Monterey, OK
  • macOS Ventura (mac mini M1) 13.0, CRASH

The first window is shown correctly (login screen)-> OK

  • The main window after login show a listbox in a container, displayed correctly → OK

From the main window,

  • most actions are displaying other containers with listbox(es), → CRASH
  • other actions, triggered by toolbar button showing new window/dialog, → OK

The original macOS crash log from the customer (MacBook M1 Ventura) is attached here.
Beginning of crash log displayed below.

I have no idea about the cause, may be Apple, Xojo, MBS or AppKit.

Any hints are welcome !

Thanks !

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               dfDiveShop [4580]
Path:                  /Applications/dfDiveShop.app/Contents/MacOS/dfDiveShop
Identifier:            com.gate61.dfdiveshop
Version:               1.1.53.4337 (1.1.53.0.4337)
Code Type:             X86-64 (Translated)
Parent Process:        launchd [1]
User ID:               502

Date/Time:             2022-10-27 16:22:45.0979 +0200
OS Version:            macOS 13.0 (22A380)
Report Version:        12
Anonymous UUID:        98981FD9-4D68-FFDE-FE40-27C3A6397A33

Sleep/Wake UUID:       FBAFFC49-3584-44D6-A763-D202A07C5EEE

Time Awake Since Boot: 30000 seconds
Time Since Wake:       300 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 0x0000000000000000
Exception Codes:       0x0000000000000001, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [4580]

VM Region Info: 0 is not in any region.  Bytes before following region: 4370223104
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      1047c5000-106831000    [ 32.4M] r-x/r-x SM=COW  ...OS/dfDiveShop

Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	    0x7ff80d49f1e9 objc_msgSend + 41
1   AppKit                        	    0x7ff81098ad79 -[NSView _finalize] + 1443
2   AppKit                        	    0x7ff81098a69f -[NSView dealloc] + 119
3   libobjc.A.dylib               	    0x7ff80d4a5a52 AutoreleasePoolPage::releaseUntil(objc_object**) + 168
4   libobjc.A.dylib               	    0x7ff80d4a28ff objc_autoreleasePoolPop + 227
5   CoreFoundation                	    0x7ff80d8a9341 _CFAutoreleasePoolPop + 22
6   Foundation                    	    0x7ff80e64bb82 -[NSAutoreleasePool drain] + 133
7   AppKit                        	    0x7ff810933025 -[NSApplication run] + 636
8   XojoFramework                 	       0x113adf47e RuntimeRun + 41
9   dfDiveShop                    	       0x1049b95b3 REALbasic._RuntimeRun + 19
10  dfDiveShop                    	       0x1065aff78 _Main + 536
11  dfDiveShop                    	       0x1065abf13 main + 19
12  dyld                          	       0x20774b310 start + 2432

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                       	    0x7ff7ffbd1750 0x7ff7ffbcd000 + 18256
1   runtime                       	    0x7ff7ffbdd66c 0x7ff7ffbcd000 + 67180
2   runtime                       	    0x7ff7ffbdf06c 0x7ff7ffbcd000 + 73836

Thread 2:
0   runtime                       	    0x7ff7ffbef87c 0x7ff7ffbcd000 + 141436

Thread 3:
0   runtime                       	    0x7ff7ffbef87c 0x7ff7ffbcd000 + 141436

Thread 4:: com.apple.NSEventThread
0   ???                           	    0x7ff89ca929a8 ???
1   libsystem_kernel.dylib        	    0x7ff80d7cc6a2 mach_msg2_trap + 10
2   libsystem_kernel.dylib        	    0x7ff80d7da67d mach_msg2_internal + 82
3   libsystem_kernel.dylib        	    0x7ff80d7d371a mach_msg_overwrite + 723
4   libsystem_kernel.dylib        	    0x7ff80d7cc989 mach_msg + 19
5   CoreFoundation                	    0x7ff80d8e602b __CFRunLoopServiceMachPort + 145
6   CoreFoundation                	    0x7ff80d8e4a84 __CFRunLoopRun + 1387
7   CoreFoundation                	    0x7ff80d8e3e9f CFRunLoopRunSpecific + 560
8   AppKit                        	    0x7ff810aa1696 _NSEventThread + 132
9   libsystem_pthread.dylib       	    0x7ff80d80b259 _pthread_start + 125
10  libsystem_pthread.dylib       	    0x7ff80d806c7b thread_start + 15


So a NSView is released too often and the crash is when the last release call is made on the released object. Could you find out which view is this.

e.g. put some objects you destroy into a global array to keep them from being freed too early.

Are you using the Einhugur PictureButton plugin in a version older than 7.1? This crashed my apps on Ventura (except in Beta 8 and 9 - don’t know what Apple changed in these betas and re-changed later on) when closing a window with a PictureButton in it…

No, I’m using Einhugur CustomButtons 3.0.6

Not sure I understand what you propose.
I have a main menu window with an embedded container (menu container).
When a menu option is selected (see pseudo code below):

  • I create a new container (option container)
  • if there was already an embedded container, currentCC, I close currentCC,
  • embed the new option container in the menu container
  • replace the currentCC by the new option container

If I’m right currentCC is destroyed when replaced, do you mean I need to ‘delay’ this replacement ?
I can add currentCC in an array before replacing but it’s still pointing to the same instance… so both currentCC and the array item will be destroyed at the same time.
Not sure I’m clear :wink:

Private Sub placeCC(optionCC As Variant)
 
 Dim cc As ContainerControl = ContainerControl(optionCC)  

 ‘ currentCC is a  menu container property  
  If currentCC <> Nil Then
    currentCC.Close
  End If
  
  cc.EmbedWithin(Self, rPos.Left, rPos.top, rPos.Width, rPos.Height)
  ...  
  currentCC = cc
  currentCC.Invalidate
   
End Sub

Maybe you should update to the current version 3.5.9 - same crashing problem with Ventura as the PictureButton.

It seems to be the issue. Updated CustomButtons to 3.5.9 and no more crashes so far.
I will perform more tests as the app is fairly complex and mark your suggestion as ‘solution’ if confirmed.

Many thanks !

2 Likes

Does your app attempt to handle RuntimeException ?

I’ve just noticed that if I make an app with an event handler for this, and then deliberately write code elsewhere to cause one of these, in MacOS Ventura both the app and the Xojo IDE crashes and macOS reports the crash with a similar dump.

Deleting the RuntimeException handler, the app crashes back into the IDE, though it fails to locate the offending code that caused it

In Monterey and previous versions of MacOS the app (and the IDE) continue running fine.

.

That bug is fixed. See https://tracker.xojo.com/xojoinc/xojo/-/issues/69777 .

Ventura 13.0.1 is available (for me…)