Application Hangs

I have a large application that has started hanging recently. It seems to be a problem with the network Here is a sample. Any thoughts?

Sampling process 139 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling BrightDisplay Client (pid 139) every 1 millisecond
Process:         BrightDisplay Client [139]
Path:            /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client
Load Address:    0x1000
Identifier:      com.kiltish.bdclient
Version:         1.6.7 (1.6.7.0.1097)
Code Type:       X86
Parent Process:  launchd [130]

Date/Time:       2014-04-25 19:57:40.191 -0400
OS Version:      Mac OS X 10.9.2 (13C64)
Report Version:  7

Call graph:
    1908 Thread_953   DispatchQueue_1: com.apple.main-thread  (serial)
    + 1908 start  (in BrightDisplay Client) + 43  [0x4362c5]
    +   1908 _start  (in BrightDisplay Client) + 116  [0x43636f]
    +     1908 % main  (in BrightDisplay Client) + 36  [0x2548]
    +       1908 _Main  (in BrightDisplay Client) + 257  [0x2a27]
    +         1908 REALbasic._RuntimeRun  (in BrightDisplay Client) + 34  [0x1def99]
    +           1908 RuntimeRun  (in rbframework.dylib) + 50  [0x583c12]
    +             1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x83587  [0x5b2587]
    +               1908 -[NSApplication run]  (in AppKit) + 823  [0x93f5a1fc]
    +                 1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0xffc65  [0x62ec65]
    +                   1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x83504  [0x5b2504]
    +                     1908 Application._CallFunctionWithExceptionHandling%%o<Application>p  (in BrightDisplay Client) + 248  [0xac553]
    +                       1908 Delegate.Invoke%%  (in BrightDisplay Client) + 34  [0x2b3b]
    +                         1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0xffd40  [0x62ed40]
    +                           1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0xffcf4  [0x62ecf4]
    +                             1908 -[NSApplication sendEvent:]  (in AppKit) + 4034  [0x941158fd]
    +                               1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x13277c  [0x66177c]
    +                                 1908 -[NSWindow sendEvent:]  (in AppKit) + 4154  [0x94177c26]
    +                                   1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x1083a7  [0x6373a7]
    +                                     1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0xf14d1  [0x6204d1]
    +                                       1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x6e0a1  [0x59d0a1]
    +                                         1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0xc2d34  [0x5f1d34]
    +                                           1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x6df8e  [0x59cf8e]
    +                                             1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x2e835  [0x55d835]
    +                                               1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x2dfa9  [0x55cfa9]
    +                                                 1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x2e6f1  [0x55d6f1]
    +                                                   1908 UpgradeScriptInfoToTextEncodingImplementation  (in CarbonCore) + 680  [0x900c81c8]
    +                                                     1908 DoesFontnameMatchScript  (in CarbonCore) + 74  [0x9015a919]
    +                                                       1908 GetFNum  (in QD) + 17  [0x984e5b58]
    +                                                         1908 FOGetFontFamilyFromName  (in ATS) + 55  [0x97f3ccd2]
    +                                                           1908 _eFOGetFontFamilyFromName  (in ATS) + 241  [0x97efe109]
    +                                                             1908 ???  (in <unknown binary>)  [0xffffffff]
    +                                                               1908 _sigtramp  (in libsystem_platform.dylib) + 43  [0x93e95deb]
    +                                                                 1908 GotEvent(int)  (in MBS Xojo Util Plugin.xojo_plugin_32.dylib) + 133  [0xff1b75]
    +                                                                   1908 MySignalHandlerMBS.Event_Signal%%o<MySignalHandlerMBS>i4  (in BrightDisplay Client) + 438  [0x429b1f]
    +                                                                     1908 BugReporter.BugReporter.!ShowExceptionReporter%%sA1s  (in BrightDisplay Client) + 1446  [0x40a1f1]
    +                                                                       1908 BugReporter.BugReporter.SetDetails%%o<BugReporter.BugReporter>o<RuntimeException>o<FolderItem>  (in BrightDisplay Client) + 11640  [0x404389]
    +                                                                         1908 _SystemClass.CommandLine%s%o<_SystemClass>  (in BrightDisplay Client) + 59  [0xa1068]
    +                                                                           1908 SystemGetCommandLine  (in rbframework.dylib) + 213  [0x558855]
    +                                                                             1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x2dfa9  [0x55cfa9]
    +                                                                               1908 ???  (in rbframework.dylib)  load address 0x52f000 + 0x2e6f1  [0x55d6f1]
    +                                                                                 1908 UpgradeScriptInfoToTextEncodingImplementation  (in CarbonCore) + 680  [0x900c81c8]
    +                                                                                   1908 DoesFontnameMatchScript  (in CarbonCore) + 74  [0x9015a919]
    +                                                                                     1908 GetFNum  (in QD) + 17  [0x984e5b58]
    +                                                                                       1908 FOGetFontFamilyFromName  (in ATS) + 55  [0x97f3ccd2]
    +                                                                                         1908 _eFOGetFontFamilyFromName  (in ATS) + 241  [0x97efe109]
    +                                                                                           1908 FindKeyForPString  (in ATS) + 38  [0x97efe39b]
    1908 Thread_1179   DispatchQueue_2: com.apple.libdispatch-manager  (serial)
    + 1908 _dispatch_mgr_thread  (in libdispatch.dylib) + 52  [0x9aca9546]
    +   1908 _dispatch_mgr_invoke  (in libdispatch.dylib) + 238  [0x9aca98ad]
    +     1908 kevent64  (in libsystem_kernel.dylib) + 10  [0x99aa0992]
    1908 Thread_1256
    + 1908 thread_start  (in libsystem_pthread.dylib) + 34  [0x90a71cf2]
    +   1908 _pthread_start  (in libsystem_pthread.dylib) + 130  [0x90a6c485]
    +     1908 _pthread_body  (in libsystem_pthread.dylib) + 144  [0x90a6c5fb]
    +       1908 _NSEventThread  (in AppKit) + 283  [0x94111b68]
    +         1908 CFRunLoopRunInMode  (in CoreFoundation) + 123  [0x9944197b]
    +           1908 CFRunLoopRunSpecific  (in CoreFoundation) + 394  [0x99441b1a]
    +             1908 __CFRunLoopRun  (in CoreFoundation) + 1393  [0x99442301]
    +               1908 __CFRunLoopServiceMachPort  (in CoreFoundation) + 169  [0x99442d29]
    +                 1908 mach_msg  (in libsystem_kernel.dylib) + 68  [0x99a9a16c]
    +                   1908 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x99a9af7a]
    1908 Thread_45340
      1908 start_wqthread  (in libsystem_pthread.dylib) + 30  [0x90a71cce]
        1908 _pthread_wqthread  (in libsystem_pthread.dylib) + 372  [0x90a6ddcf]
          1908 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x99aa0046]

Total number in stack (recursive counted multiple, when >=5):

Sort by top of stack, same collapsed (when >= 5):
        FindKeyForPString  (in ATS)        1908
        __workq_kernreturn  (in libsystem_kernel.dylib)        1908
        kevent64  (in libsystem_kernel.dylib)        1908
        mach_msg_trap  (in libsystem_kernel.dylib)        1908

[quote=82782:@Brandon Skrtich][code]+ 1908 _eFOGetFontFamilyFromName (in ATS) + 241 [0x97efe109]

  • 1908 ??? (in ) [0xffffffff]
  • 1908 _sigtramp (in libsystem_platform.dylib) + 43 [0x93e95deb]
  • 1908 GotEvent(int) (in MBS Xojo Util Plugin.xojo_plugin_32.dylib) + 133 [0xff1b75]
  • 1908 MySignalHandlerMBS.Event_Signal%%o<MySignalHandlerMBS>i4  (in BrightDisplay Client) + 438  [0x429b1f]
    

[/code][/quote]

It looks like the program crashed inside of Apple’s ATS framework and then the MBS plugin caught the signal and forwarded it to your code. It later calls back into the same ATS function it crashed the first time.

Doing much of anything from a signal handler is a bad idea even from C as very little code is async-signal safe (POSIX marks only 135 functions as safe). Calling Xojo code from a signal handler is an extremely bad idea as absolutely no Xojo code is async-signal safe.

So the app crashed and froze while trying to show a bug reporter dialog.
That can happen.

Thank you Joe & Christian for taking a look. Ok, so I disabled the bug reporter and it doesnt hang any more, it just crashes.

Any idea why it would be crashing when trying to set the font?

Process:         BrightDisplay Client [155]
Path:            /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client
Identifier:      com.kiltish.bdclient
Version:         1.6.7 (1.6.7.0.1098)
Code Type:       X86 (Native)
Parent Process:  launchd [144]
Responsible:     BrightDisplay Client [155]
User ID:         501

Date/Time:       2014-04-26 14:50:47.597 -0400
OS Version:      Mac OS X 10.9.2 (13C1021)
Report Version:  11
Anonymous UUID:  BFBFD18E-FFB1-48F2-FB85-183A231FA51C


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

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000001c

VM Regions Near 0x1c:
--> __PAGEZERO             0000000000000000-0000000000001000 [    4K] ---/--- SM=NUL  /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client
    __TEXT                 0000000000001000-00000000004d4000 [ 4940K] r-x/rwx SM=COW  /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.xojo.XojoFramework          0x006b1a38 RuntimeGraphicsPrintingCancelled + 8
1   com.xojo.XojoFramework          0x006b2584 graphicsTextFontSetter + 20
2   com.kiltish.bdclient            0x00150791 Graphics.TextFont.Set%%o<Graphics>i4s + 56
3   com.kiltish.bdclient            0x00415602 ConScreenEventStyle2.ConScreenEventStyle2.GenerateImage%%o<ConScreenEventStyle2.ConScreenEventStyle2>i4 + 18313
4   com.kiltish.bdclient            0x0041fd6d ConScreenEventStyle2.ConScreenEventStyle2.Initialize%%o<ConScreenEventStyle2.ConScreenEventStyle2> + 139
5   com.kiltish.bdclient            0x00361073 ModScreen.Add%i4%i4i4si4i4i4i4 + 6004
6   com.kiltish.bdclient            0x00344280 MyWinMain.MyWinMain.Initialize%%o<MyWinMain.MyWinMain> + 6509
7   com.kiltish.bdclient            0x00385cc2 ModGeneral.Int_DisplaySetup + 5124
8   com.kiltish.bdclient            0x0036a5f5 MyHTTPGetSetings.NextFile%%o<MyHTTPGetSetings> + 700
9   com.kiltish.bdclient            0x00374575 MyHTTPGetSetings.ProcessFile%%o<MyHTTPGetSetings>so<FolderItem> + 382
10  com.kiltish.bdclient            0x0036b072 MyHTTPGetSetings.NextFile%%o<MyHTTPGetSetings> + 3385
11  com.kiltish.bdclient            0x0036a2d6 MyHTTPGetSetings.GetFromServer%%o<MyHTTPGetSetings>i4 + 391
12  com.kiltish.bdclient            0x0038bf76 ModGeneral.Int_Sync%%i4 + 1953
13  com.kiltish.bdclient            0x00367035 MyMainSocket.Event_ReceivedMessage%%o<MyMainSocket>i8s + 881
14  com.kiltish.bdclient            0x0035e54b SimpleTCPSocket.ProcessData%%o<SimpleTCPSocket> + 2031
15  com.kiltish.bdclient            0x0035d6f1 SimpleTCPSocket.Event_DataAvailable%%o<SimpleTCPSocket> + 56
16  com.xojo.XojoFramework          0x005f2d35 0x59f000 + 343349
17  com.xojo.XojoFramework          0x005f0889 0x59f000 + 333961
18  com.xojo.XojoFramework          0x005f22c0 0x59f000 + 340672
19  com.xojo.XojoFramework          0x006d0cad 0x59f000 + 1252525
20  com.xojo.XojoFramework          0x00605dd7 0x59f000 + 421335
21  com.xojo.XojoFramework          0x0061c4d4 0x59f000 + 513236
22  com.apple.CoreFoundation        0x914d1eb6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
23  com.apple.CoreFoundation        0x914d1873 __CFRunLoopDoTimer + 1395
24  com.apple.CoreFoundation        0x9154c06d __CFRunLoopDoTimers + 349
25  com.apple.CoreFoundation        0x91489363 __CFRunLoopRun + 1779
26  com.apple.CoreFoundation        0x914889fa CFRunLoopRunSpecific + 394
27  com.apple.CoreFoundation        0x9148885b CFRunLoopRunInMode + 123
28  com.apple.HIToolbox             0x9255eb7d RunCurrentEventLoopInMode + 259
29  com.apple.HIToolbox             0x9255e902 ReceiveNextEventCommon + 526
30  com.apple.HIToolbox             0x9255e6dd _BlockUntilNextEventMatchingListInModeWithFilter + 92
31  com.apple.AppKit                0x9349b389 _DPSNextEvent + 1602
32  com.apple.AppKit                0x9349a8b0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
33  com.xojo.XojoFramework          0x005c6111 0x59f000 + 160017
34  com.apple.AppKit                0x9348d19c -[NSApplication run] + 727
35  com.xojo.XojoFramework          0x006b9f27 0x59f000 + 1158951
36  com.xojo.XojoFramework          0x006b85c1 RuntimeRun + 49
37  com.kiltish.bdclient            0x0022d711 REALbasic._RuntimeRun + 34
38  com.kiltish.bdclient            0x00002a43 _Main + 257
39  com.kiltish.bdclient            0x00002564 % main + 36
40  com.kiltish.bdclient            0x004997b8 _start + 116
41  com.kiltish.bdclient            0x0049970e start + 43

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x968ad992 kevent64 + 10
1   libdispatch.dylib               0x909328ad _dispatch_mgr_invoke + 238
2   libdispatch.dylib               0x90932546 _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib          0x968a7f7a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x968a716c mach_msg + 68
2   com.apple.CoreFoundation        0x91489c09 __CFRunLoopServiceMachPort + 169
3   com.apple.CoreFoundation        0x914891e1 __CFRunLoopRun + 1393
4   com.apple.CoreFoundation        0x914889fa CFRunLoopRunSpecific + 394
5   com.apple.CoreFoundation        0x9148885b CFRunLoopRunInMode + 123
6   com.apple.AppKit                0x93644b68 _NSEventThread + 283
7   libsystem_pthread.dylib         0x902095fb _pthread_body + 144
8   libsystem_pthread.dylib         0x90209485 _pthread_start + 130
9   libsystem_pthread.dylib         0x9020ecf2 thread_start + 34

Thread 3:
0   libsystem_kernel.dylib          0x968ad046 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x9020adcf _pthread_wqthread + 372
2   libsystem_pthread.dylib         0x9020ecce start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x00719db4  ecx: 0x00000000  edx: 0x00000000
  edi: 0x0098b8d0  esi: 0x00000000  ebp: 0xbfffa148  esp: 0xbfffa140
   ss: 0x00000023  efl: 0x00010286  eip: 0x006b1a38   cs: 0x0000001b
   ds: 0x00000023   es: 0x00000023   fs: 0x00000000   gs: 0x0000000f
  cr2: 0x0000001c
  
Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14

[quote=82972:@Brandon Skrtich]Thank you Joe & Christian for taking a look. Ok, so I disabled the bug reporter and it doesnt hang any more, it just crashes.

Any idea why it would be crashing when trying to set the font?

[code]
Process: BrightDisplay Client [155]
Path: /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client
Identifier: com.kiltish.bdclient
Version: 1.6.7 (1.6.7.0.1098)
Code Type: X86 (Native)
Parent Process: launchd [144]
Responsible: BrightDisplay Client [155]
User ID: 501

Date/Time: 2014-04-26 14:50:47.597 -0400
OS Version: Mac OS X 10.9.2 (13C1021)
Report Version: 11
Anonymous UUID: BFBFD18E-FFB1-48F2-FB85-183A231FA51C

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

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000001c

VM Regions Near 0x1c:
–> __PAGEZERO 0000000000000000-0000000000001000 [ 4K] —/--- SM=NUL /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client
__TEXT 0000000000001000-00000000004d4000 [ 4940K] r-x/rwx SM=COW /Applications/BrightDisplay Client.app/Contents/MacOS/BrightDisplay Client

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.xojo.XojoFramework 0x006b1a38 RuntimeGraphicsPrintingCancelled + 8
1 com.xojo.XojoFramework 0x006b2584 graphicsTextFontSetter + 20
2 com.kiltish.bdclient 0x00150791 Graphics.TextFont.Set%%oi4s + 56
3 com.kiltish.bdclient 0x00415602 ConScreenEventStyle2.ConScreenEventStyle2.GenerateImage%%o<ConScreenEventStyle2.ConScreenEventStyle2>i4 + 18313[/quote]

Where did you get the Graphics object from? A Picture object?

No, its from a canvas

It crashes on that line:

Graphics.TextFont is a property taking a string, not a Graphics object (oi4s).

[quote=83320:@Eli Ott]It crashes on that line:

Graphics.TextFont is a property taking a string, not a Graphics object (oi4s).[/quote]

I checked my code, I am setting the font to a string.

Apparently i was wrong about the graphic object. Its coming from the “New Picture”