Compiled apps crashes on macOS10.13

I have an app that crashes at random on macOS10.13 (works fine with other OSX versions).
Below the crash report:

Any pointers were to look?

Process: ImporterV [4644]
Path: /Applications/01DVDApps/ImporterV.app/Contents/MacOS/ImporterV
Identifier: com.osbytes.importerv
Version: 1.0.4 (1.0.4)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: ImporterV [4644]
User ID: 501

Date/Time: 2018-02-14 21:53:10.951 +1100
OS Version: Mac OS X 10.13.3 (17D47)
Report Version: 12
Anonymous UUID: DA97B2A2-F57F-FED8-74F3-081B3199EAB2

Time Awake Since Boot: 620000 seconds

System Integrity Protection: enabled

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

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Assertion failed: (!sCurrentThread->mCurrentException, “”), function RoundRobin, file Common/ClassLib/RuntimeThread.cpp, line 1426.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff57fc8e3e __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff58107150 pthread_kill + 333
2 libsystem_c.dylib 0x00007fff57f25312 abort + 127
3 libsystem_c.dylib 0x00007fff57eed368 __assert_rtn + 320
4 com.xojo.XojoFramework 0x0000000108748969 CocoaAssertionDialog::AssertFired(char const*, char const*, int, char const*, char const*) + 449
5 com.xojo.XojoFramework 0x000000010890a9be 0x1086aa000 + 2492862
6 com.xojo.XojoFramework 0x000000010877de62 0x1086aa000 + 867938
7 com.apple.CoreFoundation 0x00007fff3056bdd4 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
8 com.apple.CoreFoundation 0x00007fff3056ba47 __CFRunLoopDoTimer + 1095
9 com.apple.CoreFoundation 0x00007fff3056b54a __CFRunLoopDoTimers + 346
10 com.apple.CoreFoundation 0x00007fff30562b4b __CFRunLoopRun + 2427
11 com.apple.CoreFoundation 0x00007fff30561f43 CFRunLoopRunSpecific + 483
12 com.apple.HIToolbox 0x00007fff2f879e26 RunCurrentEventLoopInMode + 286
13 com.apple.HIToolbox 0x00007fff2f879b96 ReceiveNextEventCommon + 613
14 com.apple.HIToolbox 0x00007fff2f879914 _BlockUntilNextEventMatchingListInModeWithFilter + 64
15 com.apple.AppKit 0x00007fff2db44f5f _DPSNextEvent + 2085
16 com.apple.AppKit 0x00007fff2e2dab4c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
17 com.xojo.XojoFramework 0x000000010877d07b 0x1086aa000 + 864379
18 com.xojo.XojoFramework 0x000000010877d0bf 0x1086aa000 + 864447
19 com.osbytes.importerv 0x00000001064583b5 Application._CallFunctionWithExceptionHandling%%op + 181
20 com.xojo.XojoFramework 0x00000001088fd4df CallFunctionWithExceptionHandling(void (*)()) + 262
21 com.xojo.XojoFramework 0x000000010877d028 0x1086aa000 + 864296
22 com.apple.AppKit 0x00007fff2db39d6d -[NSApplication run] + 764
23 com.xojo.XojoFramework 0x00000001088fb80b RuntimeRun + 40
24 com.osbytes.importerv 0x0000000106507733 REALbasic._RuntimeRun + 19
25 com.osbytes.importerv 0x0000000107e3606e _Main + 478
26 com.osbytes.importerv 0x0000000107e33f53 main + 19
27 libdyld.dylib 0x00007fff57e79115 start + 1

Thread 1:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fff57fbf7c2 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff57fbecdc mach_msg + 60
2 com.apple.CoreFoundation 0x00007fff30563575 __CFRunLoopServiceMachPort + 341
3 com.apple.CoreFoundation 0x00007fff305628c7 __CFRunLoopRun + 1783
4 com.apple.CoreFoundation 0x00007fff30561f43 CFRunLoopRunSpecific + 483
5 com.apple.AppKit 0x00007fff2dc823c8 _NSEventThread + 184
6 libsystem_pthread.dylib 0x00007fff581046c1 _pthread_body + 340
7 libsystem_pthread.dylib 0x00007fff5810456d _pthread_start + 377
8 libsystem_pthread.dylib 0x00007fff58103c5d thread_start + 13

Thread 2:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x00007fff57fbf7c2 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff57fbecdc mach_msg + 60
2 com.apple.CoreFoundation 0x00007fff30563575 __CFRunLoopServiceMachPort + 341
3 com.apple.CoreFoundation 0x00007fff305628c7 __CFRunLoopRun + 1783
4 com.apple.CoreFoundation 0x00007fff30561f43 CFRunLoopRunSpecific + 483
5 com.apple.CFNetwork 0x00007fff2f6daf84 -[__CoreSchedulingSetRunnable runForever] + 722
6 com.apple.Foundation 0x00007fff32641ee8 NSThread__start + 1197
7 libsystem_pthread.dylib 0x00007fff581046c1 _pthread_body + 340
8 libsystem_pthread.dylib 0x00007fff5810456d _pthread_start + 377
9 libsystem_pthread.dylib 0x00007fff58103c5d thread_start + 13

Thread 3:
0 libsystem_kernel.dylib 0x00007fff57fc8cee __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fff58105662 _pthread_cond_wait + 732
2 com.xojo.XojoFramework 0x00000001087d0df4 xojo::ConditionVariable::Wait(xojo::UniqueLock&) + 12
3 com.xojo.XojoFramework 0x000000010890ca61 0x1086aa000 + 2501217
4 com.xojo.XojoFramework 0x000000010890a9ee 0x1086aa000 + 2492910
5 com.osbytes.importerv 0x00000001064393bb Thread.Sleep%%oi8b + 11
6 com.osbytes.importerv 0x00000001073d4340 FFmpegEngine.OnePassCode%b%o + 10512
7 com.osbytes.importerv 0x00000001073c636f FFmpegEngine.Event_Run%%o + 20847
8 com.xojo.XojoFramework 0x000000010890bdc2 0x1086aa000 + 2497986
9 com.xojo.XojoFramework 0x00000001087d0bc1 0x1086aa000 + 1207233
10 libsystem_pthread.dylib 0x00007fff581046c1 _pthread_body + 340
11 libsystem_pthread.dylib 0x00007fff5810456d _pthread_start + 377
12 libsystem_pthread.dylib 0x00007fff58103c5d thread_start + 13

Thread 4:
0 libsystem_kernel.dylib 0x00007fff57fc9562 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff5810406a _pthread_wqthread + 1035
2 libsystem_pthread.dylib 0x00007fff58103c4d start_wqthread + 13

Thread 5:
0 libsystem_kernel.dylib 0x00007fff57fc9562 __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff5810406a _pthread_wqthread + 1035
2 libsystem_pthread.dylib 0x00007fff58103c4d start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007fff90ecf340 rcx: 0x00007ffee97f91c8 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007ffee97f9200 rsp: 0x00007ffee97f91c8
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000206
r12: 0x0000000000000307 r13: 0x000000010be9f000 r14: 0x0000000000000006 r15: 0x000000000000002d
rip: 0x00007fff57fc8e3e rfl: 0x0000000000000206 cr2: 0x00007fff90ead148

Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133

Does the app contain any plugins or declares?
If so, are they 32bit, since it looks like you compiled for 64bit?

Only 64bit MBS plugins and Christian says the crash isn’t fault of his MBS plugins.

[quote=373473:@Christoph De Vocht]7 com.apple.CoreFoundation 0x00007fff3056bdd4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 8 com.apple.CoreFoundation 0x00007fff3056ba47 __CFRunLoopDoTimer + 1095 9 com.apple.CoreFoundation 0x00007fff3056b54a __CFRunLoopDoTimers + 346 10 com.apple.CoreFoundation 0x00007fff30562b4b __CFRunLoopRun + 2427 11 com.apple.CoreFoundation 0x00007fff30561f43 CFRunLoopRunSpecific + 483[/quote]
I see this on almost every crash my apps witness on 10.12 and 10.13. The question is whether this is caused by something in Xojo’s framework or in Apple’s library.

It’s not consistent AND I see it with both 64bit and 32bit versions of the apps.

Are you using a property over multiple threads?

i see similarities with this address: 0x1086aa000
in the main thread 0 and thread 3.

I’ve seen those RunLoopDoTimer crashes, too. In my case I don’t use any timers so I’m guessing it’s some sort of internal timer.

Here is my take on the crash log above:

One thread is sleeping:

5 com.osbytes.importerv 0x00000001064393bb Thread.Sleep%%oi8b + 11
6 com.osbytes.importerv 0x00000001073d4340 FFmpegEngine.OnePassCode%b%o + 10512

The crashing thread is puking on a failed assertion:

Assertion failed: (!sCurrentThread->mCurrentException, “”), function RoundRobin, file Common/ClassLib/RuntimeThread.cpp, line 1426.
4 com.xojo.XojoFramework 0x0000000108748969 CocoaAssertionDialog::AssertFired(char const*, char const*, int, char const*, char const*) + 449

I dimly remember having seen problems with this assertion but from running within Xojo. But I wasn’t able to find anything.

Can you tell us more about the architecture of your app?

Before the app crashes it shows this error (which is an Xojo error).

“Location: Common/ClassLib/RuntimeThread.cpp:1426
Condition: !sCurrentThread->mCurrentException”

The app creates one thread. Inside that thread there is a do-loop doing all sort of things that can take a long time (read: 30 minutes or more).
Inside the do-loop I use sleep(250) to keep everything else a live. Without the sleep, the main thread is always using 100% CPU time.
Maybe I need to make it sleep longer and use sleep(1000,thru) so it can return whenever it needs?

FWW: function RoundRobin is not a function used in my app.

This error message was discussed here:

https://forum.xojo.com/37481-failure-condition-scurrentthread-mcurrentexception/0
https://forum.xojo.com/28065-thread-error-in-socket/0
https://forum.xojo.com/34163-threading-error-assertion-failed/0

So it seems it is a bug still present in Xojo and Joe just saying it is a serious issue. I tried with the latest Xojo alpha and it also pops up.

I thought the whole point of a thread was to already keep UI updates and such alive.

What is the priority of the thread? I have found in the app I’m currently working on that a higher priority doesn’t give me better performance, but it does affect UI updates. Leaving at the default 5 seems to give me the best balanace.

Perhaps you could consider using an helper application instead? Which I will be in a later revision of this application (providing I can figure out the logistics, it’s a Sandboxed application and while I’ve followed the guidelines it’s still crapping out with passing files).

Personally I don’t think pausing that thread longer will help, but it’s worth a shot incase I’m wrong.

Even though it looks like the main thread crashed it could be because something in your other thread (thread3?) caused the problem.

Have you tried stripping out various bits of code from the thread to see if that improves stability? For example, ffmpeg could be corrupting the stack or doing something weird that Xojo doesn’t like.

If you have any pragma statements in your code I would try removing them in case they were hiding a problem.

If you haven’t already done so I would try and get a sample project to Xojo so that they can also investigate it.