On Sat, 24 Jul 2004 23:13:53 -0500, Gus Mueller <[EMAIL PROTECTED]> wrote:
> On Sat, 24 Jul 2004 15:36:50 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> <snip>
> > Can another OS X user give this a try, see if it crashes for you? Any
> > ideas what's going on?
> 
> I gave it a try, and it crashes for me as well-
> 
> This is going to sound a little weird.. but I added this right above
> where you spawn off your thread:
> [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
> 
> and it no longer crashes.  Don't ask me why though. Maybe it has to be
> warmed up or something :)


I've discovered a little bit more about the crash, but I don't know
what's causing it really- but here's the stack trace with the crash:

#0      0x01010ff8 in balance_shallower at btree.c:3286
#1      0x01010f1c in balance_nonroot at btree.c:3262
#2      0x010114e0 in balance_deeper at btree.c:3398
#3      0x01011570 in balance at btree.c:3414
#4      0x010119bc in sqlite3BtreeInsert at btree.c:3530
#5      0x0104f084 in sqlite3VdbeExec at vdbe.c:3053
#6      0x010522fc in sqlite3_step at vdbeapi.c:159
#7      0x0105db5c in sqlite3_exec at legacy.c:79
#8      0x000e37e8 in execQuery at Test.m:13
#9      0x000e3a3c in -[Test testDatabase] at Test.m:76
#10     0x90a39b74 in forkThreadForFunction
#11     0x900246e8 in _pthread_body

What's interesting is that balance_nonroot doesn't call
balance_shallower- it calls balance, and then balance calls
balance_shallower.  Here's what the stack trace looks like when you
kick off an extra thread right before the [NSThread
detachNewThreadSelector:@selector(testDatabase) toTarget:test
withObject:nil];

#0      0x01011008 in balance_shallower at btree.c:3295
#1      0x010115c0 in balance at btree.c:3420
#2      0x01010f1c in balance_nonroot at btree.c:3262
#3      0x010114e0 in balance_deeper at btree.c:3398
#4      0x01011570 in balance at btree.c:3414
#5      0x010119bc in sqlite3BtreeInsert at btree.c:3530
#6      0x0104f084 in sqlite3VdbeExec at vdbe.c:3053
#7      0x010522fc in sqlite3_step at vdbeapi.c:159
#8      0x0105db5c in sqlite3_exec at legacy.c:79
#9      0x000e37e8 in execQuery at Test.m:13
#10     0x000e3a3c in -[Test testDatabase] at Test.m:76
#11     0x90a39b74 in forkThreadForFunction
#12     0x900246e8 in _pthread_body

The stack is correct, and the app doesn't crash.  But that obviously a
silly hack that doesn't explain or fix the problem.  So is the stack
getting corrupted?  In the debugger, when it crashes at
balance_shallower, the value of the pointer to pPage is 0x0.

Maybe this will help someone figure out what's going on.. especially
since I plan on using sqlite3 on osx as well :)

-- 
-gus

Reply via email to