Quantcast
Viewing all articles
Browse latest Browse all 204402

Silent crashes while clicking on various UI controls

Hello,

I am working on the C# XamMac-based GUI application which quite often silently crashes when am clicking on some UI controls.

The layout of the UI is based on the set of square buttons on the left hand side and the central area which displays custom view depending on the which square button is clicked. Custom views contain tab views which items contain other custom views. Those custom views contain various controls like image views, labels, popup buttons, group boxes, spinners, text fields etc...Some of these controls are updated regularly on timers' events.

Crashes usually occur in situations when application has to display another (custom) view e.g.:

1) when left-hand side square buttons are clicked: central area has to hide one view and display another

2) when clicking on tabs: different tab view items contain different custom views

This may be the rule but may be not; cases I listed above are those which cause ~90% of crashes.

So, I start the app, don't use any of its functionality but start clicking on square buttons and/or tabs and app suddenly crashes.

Silent crash means it's not exception I can handle in AppDomain.CurrentDomain.UnhandledException handler. Process simply terminates and OSX creates .crash report in ~/Library/Logs/DiagnosticReports.

There are four main exception types which happen:

Exception Type: EXC_BAD_ACCESS (SIGILL)
Exception Codes: KERN_PROTECTION_FAILURE 

Exception Type: EXC_CRASH (SIGILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000b0092fec

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000

Exceptions are always thrown from this thread: Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Functions on the top of the stack are all from Apple libraries and in each crash they are almost always different. This makes me wonder that I am maybe using wrong approach in some general use of XamMac API. I don't use Interop, unsafe code; I make sure UI is updated in a main thread.

Here are some examples of crash reports:

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

Exception Type:  EXC_BAD_ACCESS (SIGILL)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000004ed000

VM Regions Near 0x4ed000:
    VM_ALLOCATE            00000000004bd000-00000000004ed000 [  192K] rw-/rwx SM=PRV  
--> VM_ALLOCATE            00000000004ed000-00000000004ee000 [    4K] r--/rwx SM=COW  
    VM_ALLOCATE            00000000004ee000-00000000004ef000 [    4K] ---/rwx SM=NUL  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x99087802 __psynch_mutexwait + 10
1   libsystem_pthread.dylib         0x95e2d945 _pthread_mutex_lock + 404
2   libsystem_pthread.dylib         0x95e2d7ac pthread_mutex_lock + 16
3   libobjc.A.dylib                 0x971b4df2 lookUpImpOrForward + 126
4   libobjc.A.dylib                 0x971aeca3 _class_lookupMethodAndLoadCache3 + 55
5   libobjc.A.dylib                 0x971ae4e1 objc_msgSend + 81
6   com.apple.AppKit                0x91297e72 -[NSLayoutManager(NSTextViewSupport) drawBackgroundForGlyphRange:atPoint:] + 77
7   com.apple.AppKit                0x91296973 -[NSTextView drawRect:] + 2068
8   com.apple.AppKit                0x91218843 -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] + 1125
9   com.apple.AppKit                0x912182d5 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 189
10  com.apple.AppKit                0x912180b8 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 2164
11  com.apple.AppKit                0x91217831 -[NSView(NSLayerKitGlue) drawLayer:inContext:] + 115
12  com.apple.AppKit                0x913104bb -[NSTextView drawLayer:inContext:] + 198
13  com.apple.AppKit                0x912177ab -[_NSViewBackingLayer drawInContext:] + 64
14  com.apple.QuartzCore            0x974b3b12 backing_callback(CGContext*, void*) + 96
15  com.apple.QuartzCore            0x97369d02 CABackingStoreUpdate_ + 3412
16  com.apple.QuartzCore            0x97368fa6 ___ZN2CA5Layer8display_Ev_block_invoke + 93
17  com.apple.QuartzCore            0x97368f3e x_blame_allocations + 88
18  com.apple.QuartzCore            0x97368a0c CA::Layer::display_() + 1552
19  com.apple.QuartzCore            0x973683f7 -[CALayer _display] + 20
20  com.apple.QuartzCore            0x973683d8 CA::Layer::display() + 186
21  com.apple.QuartzCore            0x97368316 -[CALayer display] + 20
22  com.apple.AppKit                0x912176d4 _NSBackingLayerDisplay + 255
23  com.apple.AppKit                0x912175d0 -[_NSBackingLayer display] + 26
24  com.apple.AppKit                0x911eda6f -[_NSViewBackingLayer display] + 537
25  com.apple.AppKit                0x91310368 -[_NSTextViewBackingLayer display] + 93
26  com.apple.QuartzCore            0x973680fc CA::Layer::display_if_needed(CA::Transaction*) + 690
27  com.apple.QuartzCore            0x97367870 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 38
28  com.apple.QuartzCore            0x973671c8 CA::Context::commit_transaction(CA::Transaction*) + 292
29  com.apple.QuartzCore            0x97366e2b CA::Transaction::commit() + 393
30  com.apple.QuartzCore            0x97377a7d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 75
31  com.apple.CoreFoundation        0x9940335e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
32  com.apple.CoreFoundation        0x994032af __CFRunLoopDoObservers + 399
33  com.apple.CoreFoundation        0x993f3b35 CFRunLoopRunSpecific + 421
34  com.apple.CoreFoundation        0x993f397b CFRunLoopRunInMode + 123
35  com.apple.HIToolbox             0x9b280b7d RunCurrentEventLoopInMode + 259
36  com.apple.HIToolbox             0x9b280797 ReceiveNextEventCommon + 163
37  com.apple.HIToolbox             0x9b2806dd _BlockUntilNextEventMatchingListInModeWithFilter + 92
38  com.apple.AppKit                0x910af389 _DPSNextEvent + 1602
39  com.apple.AppKit                0x910ae8b0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
40  com.apple.AppKit                0x910a119c -[NSApplication run] + 727
41  com.apple.AppKit                0x9108a038 NSApplicationMain + 1165
42  ???                             0x05c27753 0 + 96630611
43  ???                             0x05c27578 0 + 96630136
44  ???                             0x026da218 0 + 40739352
45  ???                             0x026da3cf 0 + 40739791
46  com.Privax.HMA                  0x000ef87e mono_jit_runtime_invoke + 798 (mini.c:6473)
47  com.Privax.HMA                  0x0019c12e mono_runtime_invoke + 126 (object.c:2827)
48  com.Privax.HMA                  0x001a0584 mono_runtime_exec_main + 420 (object.c:4052)
49  com.Privax.HMA                  0x001a08f5 mono_runtime_run_main + 725 (object.c:3678)
50  com.Privax.HMA                  0x00050785 mono_jit_exec + 149 (driver.c:950)
51  com.Privax.HMA                  0x0000307c main + 1692
52  com.Privax.HMA                  0x00002215 start + 53

And here is another one (out of ~50 I saved):

Exception Type:  EXC_CRASH (SIGILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libRIP.A.dylib                  0x9458da50 RIPGlyphListAppendBitmap + 48
1   libRIP.A.dylib                  0x9458d939 render_glyphs + 314
2   libRIP.A.dylib                  0x9458ca4b draw_glyph_bitmaps + 1426
3   libRIP.A.dylib                  0x9458bfda ripc_DrawGlyphs + 2041
4   com.apple.CoreGraphics          0x9870f5be draw_glyphs + 1298
5   com.apple.CoreGraphics          0x9868ef25 CGContextShowGlyphsAtPositions + 159
6   com.apple.CoreText              0x97c4f4c5 CTFontDrawGlyphsAtPositions + 289
7   com.apple.AppKit                0x9123828c -[NSLayoutManager(NSTextViewSupport) showCGGlyphs:positions:count:font:matrix:attributes:inContext:] + 619
8   com.apple.AppKit                0x91237ffc -[NSLayoutManager(NSTextViewSupport) showCGGlyphs:positions:count:font:color:matrix:attributes:inContext:textLayer:] + 1008
9   com.apple.AppKit                0x91235013 -[NSLayoutManager(NSPrivate) _drawGlyphsForGlyphRange:atPoint:] + 12951
10  com.apple.AppKit                0x91231d75 -[NSLayoutManager(NSTextViewSupport) drawGlyphsForGlyphRange:atPoint:] + 129
11  com.apple.AppKit                0x912969b7 -[NSTextView drawRect:] + 2136
12  com.apple.AppKit                0x91218843 -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] + 1125
13  com.apple.AppKit                0x912182d5 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 189
14  com.apple.AppKit                0x912180b8 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 2164
15  com.apple.AppKit                0x91217831 -[NSView(NSLayerKitGlue) drawLayer:inContext:] + 115
16  com.apple.AppKit                0x913104bb -[NSTextView drawLayer:inContext:] + 198
17  com.apple.AppKit                0x912177ab -[_NSViewBackingLayer drawInContext:] + 64
18  com.apple.QuartzCore            0x974b3b12 backing_callback(CGContext*, void*) + 96
19  com.apple.QuartzCore            0x97369d02 CABackingStoreUpdate_ + 3412
20  com.apple.QuartzCore            0x97368fa6 ___ZN2CA5Layer8display_Ev_block_invoke + 93
21  com.apple.QuartzCore            0x97368f3e x_blame_allocations + 88
22  com.apple.QuartzCore            0x97368a0c CA::Layer::display_() + 1552
23  com.apple.QuartzCore            0x973683f7 -[CALayer _display] + 20
24  com.apple.QuartzCore            0x973683d8 CA::Layer::display() + 186
25  com.apple.QuartzCore            0x97368316 -[CALayer display] + 20
26  com.apple.AppKit                0x912176d4 _NSBackingLayerDisplay + 255
27  com.apple.AppKit                0x912175d0 -[_NSBackingLayer display] + 26
28  com.apple.AppKit                0x911eda6f -[_NSViewBackingLayer display] + 537
29  com.apple.AppKit                0x91310368 -[_NSTextViewBackingLayer display] + 93
30  com.apple.QuartzCore            0x973680fc CA::Layer::display_if_needed(CA::Transaction*) + 690
31  com.apple.QuartzCore            0x97367870 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 38
32  com.apple.QuartzCore            0x973671c8 CA::Context::commit_transaction(CA::Transaction*) + 292
33  com.apple.QuartzCore            0x97366e2b CA::Transaction::commit() + 393
34  com.apple.QuartzCore            0x97377a7d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 75
35  com.apple.CoreFoundation        0x9940335e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
36  com.apple.CoreFoundation        0x994032af __CFRunLoopDoObservers + 399
37  com.apple.CoreFoundation        0x993f3b35 CFRunLoopRunSpecific + 421
38  com.apple.CoreFoundation        0x993f397b CFRunLoopRunInMode + 123
39  com.apple.HIToolbox             0x9b280b7d RunCurrentEventLoopInMode + 259
40  com.apple.HIToolbox             0x9b280797 ReceiveNextEventCommon + 163
41  com.apple.HIToolbox             0x9b2806dd _BlockUntilNextEventMatchingListInModeWithFilter + 92
42  com.apple.AppKit                0x910af389 _DPSNextEvent + 1602
43  com.apple.AppKit                0x910ae8b0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
44  com.apple.AppKit                0x910a119c -[NSApplication run] + 727
45  com.apple.AppKit                0x9108a038 NSApplicationMain + 1165
46  ???                             0x052ce028 0 + 86827048
47  ???                             0x052cdf30 0 + 86826800
48  ???                             0x027d9f60 0 + 41787232
49  ???                             0x027da05f 0 + 41787487
50  com.Privax.HMA                  0x000ef87e mono_jit_runtime_invoke + 798 (mini.c:6473)
51  com.Privax.HMA                  0x0019c12e mono_runtime_invoke + 126 (object.c:2827)
52  com.Privax.HMA                  0x001a0584 mono_runtime_exec_main + 420 (object.c:4052)
53  com.Privax.HMA                  0x001a08f5 mono_runtime_run_main + 725 (object.c:3678)
54  com.Privax.HMA                  0x00050785 mono_jit_exec + 149 (driver.c:950)
55  com.Privax.HMA                  0x0000307c main + 1692
56  com.Privax.HMA                  0x00002215 start + 53

I don't want to bloat this post with long crash reports, but can attach them upon request in one of my following posts. All my code is in C#, I am using XamMac 1.6.27, targeting framework .NET 4.5.

Here are details from Xamarin Studio:

=== Xamarin Studio ===

Version 4.2.3 (build 60)
Installation UUID: 6aa6117d-...
Runtime:
    Mono 3.2.6 ((no/9b58377)
    GTK+ 2.24.23 theme: Raleigh
    GTK# (2.12.0.0)
    Package version: 302060000

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.Mac ===

Xamarin.Mac: 1.6.27

=== Build Information ===

Release ID: 402030060
Git revision: 30c4afc300c2a39ec5300851357ce02e49dd217e
Build date: 2014-03-05 22:09:33+0000
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044

=== Operating System ===

Mac OS X 10.9.2
Darwin xxx 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

So, the question is: Where shall I start digging if I want to discover what causes these crashes? Has anyone else experienced/reported similar silent crashes?

I created test-app with the similar layout which does not crash at all.

If you need more information and/or crash reports, please let me know and I will attach them.

Thanks


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>