discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux


From: Lobron, David
Subject: Re: Mysterious crash in NSRunLoop, using libobjc2 on Linux
Date: Thu, 7 Dec 2017 19:54:49 +0000

> TL;DR: It looks as if the unwinder is first finding a catch block when the 
> exception is thrown, but then not finding it when the exception is rethrown 
> after running cleanups.  This is quite surprising, and the only thing I can 
> think of that would cause it (modulo bugs in the ObjC personality function - 
> which are entirely possible as it’s a horribly complex piece of code) is if 
> the exception passed back into _Unwind_Resume is not the same exception as 
> the one initially thrown.

Thank you for that explanation (it wasn't too long, and I did read it). :-)

> Please can you also try sticking a breakpoint on objc_exception_throw and 
> objc_exception_rethrow?  

I set those breakpoints, in addition to ones on -[NSException raise], 
_Unwind_Resume, and abort.  I've pasted the steps below (I trimmed the stack 
traces on all but the first one, for brevity - there are 13 breakpoint hits, 
including the last one on the abort call):

1) The initial exception:
Breakpoint 1, -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff6179190 
<.objc_selector_list+352>) at NSException.m:1137
1137      if (_reserved == 0)
#0  -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff6179190 
<.objc_selector_list+352>) at NSException.m:1137
#1  0x00007ffff5cc4af0 in +[NSException raise:format:] (self=0x1715ac80, 
_cmd=<optimized out>, name=0xa450138, format=0x59d34) at NSException.m:1016
#2  0x00000000004d2745 in parsePingTreeSymbol(NSString*, void*) 
(symbol=0xa478dd0, context=0x2e17390) at PingState.mm:83
#3  0x00007ffff6f28004 in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=0x104f940, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:827
#4  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] (self=0x0, 
_cmd=<optimized out>, path=0xa450138) at PingState.mm:305
#5  0x00007ffff6ecc867 in -[FileAcceptor checkForObject] (self=0x2e16db0, 
_cmd=<optimized out>) at FileAcceptor.m:630
#6  0x00000000004ccd0c in PingScoresRebaser::rebase() (this=0x359e7f0) at 
PingScoresRebaser.mm:208
#7  0x00000000004c301b in RebaserProxy<PingScoresRebaser>::rebase() 
(this=<optimized out>) at ./RebaserProxy.h:202
#8  0x00000000004c1cb7 in RebaserProxy<PingScoresRebaser>::operator->() 
(this=0xf30f60) at ./RebaserProxy.h:262
#9  0x00000000004bda9a in -[MapMaker readNewInputs] (self=0xb645b0, 
_cmd=<optimized out>) at MapMaker.mm:1708
#10 0x00000000004bdbad in -[MapMaker readInputsAndMakeMap] (self=0xb645b0, 
_cmd=<optimized out>) at MapMaker.mm:1739
#11 0x00000000004bee19 in -[MapMaker doWork] (self=0xb645b0, _cmd=<optimized 
out>) at MapMaker.mm:2017
#12 0x00007ffff6e9be16 in -[AkamaiDaemon(PrivateMethods) doOneCycle:] 
(self=0xb645b0, _cmd=<optimized out>, ignored=<optimized out>) at 
AkamaiDaemon.m:467
#13 0x00007ffff5d58897 in -[NSTimer fire] (self=0x1037e30, _cmd=<optimized 
out>) at NSTimer.m:283
#14 0x00007ffff5d33059 in -[NSRunLoop _limitDateForContext:] (self=0xe14760, 
_cmd=<optimized out>, context=0xe29850) at NSRunLoop.m:1011
#15 0x00007ffff5d33498 in -[NSRunLoop limitDateForMode:] (self=0xe14760, 
_cmd=0x7ffff61b2d58 <.objc_selector_list+160>, mode=0x7ffff61b1e38 <.objc_str>)
    at NSRunLoop.m:1111
#16 0x00007ffff5d33c56 in -[NSRunLoop runMode:beforeDate:] (self=0xe14760, 
_cmd=0x7ffff61b2df8 <.objc_selector_list+320>, mode=0x7ffff61b1e38 <.objc_str>, 
    date=0xfcaff0) at NSRunLoop.m:1285
#17 0x00007ffff5d33d61 in -[NSRunLoop runUntilDate:] (self=0xe14760, 
_cmd=<optimized out>, date=0xfcaff0) at NSRunLoop.m:1334
#18 0x00007ffff6e9e2ec in -[AkamaiDaemon mainLoop] (self=0xb645b0, 
_cmd=<optimized out>) at AkamaiDaemon.m:1080
#19 0x00000000004c4bf9 in main (argc=<optimized out>, argv=<optimized out>) at 
MapMakerMainFunc.mm:29

2)
Breakpoint 4, objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
161             SEL rethrow_sel = sel_registerName("rethrow");
(gdb) bt
#0  objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
#1  0x00007ffff5cc5188 in -[NSException raise] (self=0x1715ac80, 
_cmd=<optimized out>) at NSException.m:1148
#2  0x00007ffff5cc4af0 in +[NSException raise:format:] (self=0x1715ac80, 
_cmd=<optimized out>, name=0x0, format=0x132295a0) at NSException.m:1016
#3  0x00000000004d2745 in parsePingTreeSymbol(NSString*, void*) 
(symbol=0xa478dd0, context=0x2e17390) at PingState.mm:83
...

3)
Breakpoint 1, -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff74ed618 
<.objc_selector_list+480>) at NSException.m:1137
1137      if (_reserved == 0)
(gdb) bt
#0  -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff74ed618 
<.objc_selector_list+480>) at NSException.m:1137
#1  0x00007ffff6f282ea in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=0x104f940, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:847
#2  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] (self=0x0, 
_cmd=<optimized out>, path=0xa44fff8) at PingState.mm:305
...

4)
Breakpoint 4, objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
161             SEL rethrow_sel = sel_registerName("rethrow");
(gdb) bt
#0  objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
#1  0x00007ffff5cc5188 in -[NSException raise] (self=0x1715ac80, 
_cmd=<optimized out>) at NSException.m:1148
#2  0x00007ffff6f282ea in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=0x104f940, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:847
#3  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] (self=0x0, 
_cmd=<optimized out>, path=0xa44fff8) at PingState.mm:305
...

5) 
Breakpoint 1, -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff74ed618 
<.objc_selector_list+480>) at NSException.m:1137
1137      if (_reserved == 0)
(gdb) bt
#0  -[NSException raise] (self=0x1715ac80, _cmd=0x7ffff74ed618 
<.objc_selector_list+480>) at NSException.m:1137
#1  0x00007ffff6f284d4 in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=0xa4777a0, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:862
#2  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] (self=0x0, 
_cmd=<optimized out>, path=0xa44fff8) at PingState.mm:305
#3  0x00007ffff6ecc867 in -[FileAcceptor checkForObject] (self=0x2e16db0, 
_cmd=<optimized out>) at FileAcceptor.m:630
...

6)
Breakpoint 4, objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
161             SEL rethrow_sel = sel_registerName("rethrow");
(gdb) bt
#0  objc_exception_throw (object=0x1715ac80) at 
/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/eh_personality.c:161
#1  0x00007ffff5cc5188 in -[NSException raise] (self=0x1715ac80, 
_cmd=<optimized out>) at NSException.m:1148
#2  0x00007ffff6f284d4 in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=0xa4777a0, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:862
#3  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] (self=0x0, 
_cmd=<optimized out>, path=0xa44fff8) at PingState.mm:305
#4  0x00007ffff6ecc867 in -[FileAcceptor checkForObject] (self=0x2e16db0, 
_cmd=<optimized out>) at FileAcceptor.m:630
...

7) First call to _Unwind_Resume, as we go one frame up the stack:

Breakpoint 2, _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:224
224     ../../../src/libgcc/unwind.inc: No such file or directory.
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00007ffff6f2850d in -[RadixTree 
initWithFileDescriptor:symbolParserFunction:context:] (self=<optimized out>, 
_cmd=<optimized out>, fd=<optimized out>, 
    parser=0x4d2410 <parsePingTreeSymbol(NSString*, void*)>, context=0x2e17390) 
at RadixTree.mm:863
#2  0x00000000004d23c7 in -[PingTreeParser pingTreeWithFile:] 
(self=0x7fffffffb998, _cmd=<optimized out>, path=0x0) at PingState.mm:305
#3  0x00007ffff6ecc867 in -[FileAcceptor checkForObject] (self=0x2e16db0, 
_cmd=<optimized out>) at FileAcceptor.m:630
#4  0x00000000004ccd0c in PingScoresRebaser::rebase() (this=0x359e7f0) at 
PingScoresRebaser.mm:208
...

8)
Breakpoint 2, _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:224
224     in ../../../src/libgcc/unwind.inc
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00007ffff6ecc990 in -[FileAcceptor checkForObject] (self=0x2e16db0, 
_cmd=<optimized out>) at FileAcceptor.m:639
#2  0x00000000004ccd0c in PingScoresRebaser::rebase() (this=0x359e7f0) at 
PingScoresRebaser.mm:208
#3  0x00000000004c301b in RebaserProxy<PingScoresRebaser>::rebase() 
(this=<optimized out>) at ./RebaserProxy.h:202
#4  0x00000000004c1cb7 in RebaserProxy<PingScoresRebaser>::operator->() 
(this=0xf30f60) at ./RebaserProxy.h:262
#5  0x00000000004bda9a in -[MapMaker readNewInputs] (self=0xb645b0, 
_cmd=<optimized out>) at MapMaker.mm:1708
...

9)
Breakpoint 2, _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:224
224     in ../../../src/libgcc/unwind.inc
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00000000004bdb86 in -[MapMaker readNewInputs] (self=0xb645b0, 
_cmd=<optimized out>) at MapMaker.mm:1721
#2  0x00000000004bdbad in -[MapMaker readInputsAndMakeMap] (self=0xb645b0, 
_cmd=<optimized out>) at MapMaker.mm:1739
#3  0x00000000004bee19 in -[MapMaker doWork] (self=0xb645b0, _cmd=<optimized 
out>) at MapMaker.mm:2017
...

10)
Breakpoint 2, _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:224
224     in ../../../src/libgcc/unwind.inc
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00007ffff6e9bf10 in -[AkamaiDaemon(PrivateMethods) doOneCycle:] 
(self=0xb645b0, _cmd=<optimized out>, ignored=<optimized out>) at 
AkamaiDaemon.m:470
#2  0x00007ffff5d58897 in -[NSTimer fire] (self=0x1037e30, _cmd=<optimized 
out>) at NSTimer.m:283
#3  0x00007ffff5d33059 in -[NSRunLoop _limitDateForContext:] (self=0xe14760, 
_cmd=<optimized out>, context=0xe29850) at NSRunLoop.m:1011
...

11)
224     in ../../../src/libgcc/unwind.inc
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00007ffff5d58a0c in -[NSTimer fire] (self=0x1037e30, _cmd=<optimized 
out>) at NSTimer.m:287
#2  0x00007ffff5d33059 in -[NSRunLoop _limitDateForContext:] (self=0xe14760, 
_cmd=<optimized out>, context=0xe29850) at NSRunLoop.m:1011
#3  0x00007ffff5d33498 in -[NSRunLoop limitDateForMode:] (self=0xe14760, 
_cmd=0x7ffff61b2d58 <.objc_selector_list+160>, mode=0x7ffff61b1e38 <.objc_str>)
    at NSRunLoop.m:1111
...

12)
Breakpoint 2, _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:224
224     in ../../../src/libgcc/unwind.inc
(gdb) bt
#0  _Unwind_Resume (exc=0xa6df4e0) at ../../../src/libgcc/unwind.inc:224
#1  0x00007ffff5d33585 in -[NSRunLoop limitDateForMode:] (self=0xe14760, 
_cmd=0x7ffff61b2d58 <.objc_selector_list+160>, mode=0x7ffff61b1e38 <.objc_str>)
    at NSRunLoop.m:1119
#2  0x00007ffff5d33c56 in -[NSRunLoop runMode:beforeDate:] (self=0xe14760, 
_cmd=0x7ffff61b2df8 <.objc_selector_list+320>, mode=0x7ffff61b1e38 <.objc_str>, 
    date=0xfcaff0) at NSRunLoop.m:1285
...

13)
Breakpoint 3, __GI_abort () at abort.c:51
51      abort.c: No such file or directory.
(gdb) bt
#0  __GI_abort () at abort.c:51
#1  0x00007ffff4f6f521 in _Unwind_Resume (exc=0xa6df4e0) at 
../../../src/libgcc/unwind.inc:234
#2  0x00007ffff5d33585 in -[NSRunLoop limitDateForMode:] (self=0xe14760, 
_cmd=0x7ffff61b2d58 <.objc_selector_list+160>, mode=0x7ffff61b1e38 <.objc_str>)
    at NSRunLoop.m:1119
#3  0x00007ffff5d33c56 in -[NSRunLoop runMode:beforeDate:] (self=0xe14760, 
_cmd=0x7ffff61b2df8 <.objc_selector_list+320>, mode=0x7ffff61b1e38 <.objc_str>, 
    date=0xfcaff0) at NSRunLoop.m:1285

> There are also a bunch of debug logs that are compiled out in the EH code - 
> if you #define DEBUG_LOG at the top of eh_personality.c then you should see 
> them and get a better idea of what’s going on.

I did this, and I've pasted the output below.  At first glance, the exceptions 
all seem to be the same (or at least, all have the same address of 0x17158c80). 
 I'm not entirely sure how to interpret the rest of the action there.  One 
thing that leaps out is that there seem to be personalities involved: GNUCOBJC 
and GNUCC++.  The code that throws this exception is a .mm file, i.e., 
Objective-C++, with a mix of ObjC and C++.  

Any help is appreciated!

Thanks,

David

Log contents with debugging enabled:

Log at first breakpoint:
Throwing 0x17158c80

At second:
Throwing 0x17158c80
Throwing 0x17158c80

At third:
Throwing 0x17158c80
Throwing 0x17158c80
Throwing 0x17158c80
New personality function called 0xa477680
Class: GNUCOBJC
LSDA: 0x7ffff721df44
Search phase...
Filter: 1
Class name: NSException
0x7ffff6177de8 type: 1
found handler for NSException
handler: 4
Found handler! 4
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff721df44
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
Filter: 1
Class name: NSException
0x7ffff6177de8 type: 0
Filter: 0
0 filter
handler! 1 0
Installing cleanup...
Installing context, selector 0
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff721df44
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff721ba0c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
Filter: 1
Class name: NSException
0x7ffff6177de8 type: 0
Filter: 0
0 filter
handler! 1 0
Installing cleanup...
Installing context, selector 0
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff721ba0c
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff5f28ca4
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
Filter: 1
Class name: NSException
0x7ffff6177de8 type: 0
Filter: 0
0 filter
handler! 1 0
Installing cleanup...
Installing context, selector 0
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff5f28ca4
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff5f28300
Phase 2: Fight!
Not the handler frame, looking up the cleanup again
Filter: 1
Class name: NSException
0x7ffff6177de8 type: 0
Filter: 0
0 filter
handler! 1 0
Installing cleanup...
Installing context, selector 0
New personality function called 0xa6dddf0
Class: GNUCC++
Foreign class: 0x7ffff6136a28
LSDA: 0x7ffff5f28300
Phase 2: Fight!
Not the handler frame, looking up the cleanup again

At this point, abort is called.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]