PBCatalogSearchAsync and pthreads
Subject : PBCatalogSearchAsync and pthreads
From: "Umed Zokirov" <email@hidden >
Date: Thu, 29 Sep 2005 20:07:44 +0000
Delivered-to: email@hidden
Delivered-to: email@hidden
Hi there,
We have an installer that searches for a copy of our application on user's
machines using PBCatalogSearchAsync. Basically for every mounted volume we
spun off a pthread that calls
PBCatalogSearchAsync and in PBCatalogSearchAsync's completion routine we add
the search results to an array(using a mutex).
Unfortunately our application crashes with the follwoing snippet from a
crash reporter:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000058
Thread 0:
0 libSystem.B.dylib 0x9000a738 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a67c mach_msg + 60
2 com.apple.CoreFoundation 0x9f8d8338 __CFRunLoopRun + 832
3 com.apple.CoreFoundation 0x9f8d7c3c CFRunLoopRunSpecific + 268
4 com.apple.HIToolbox 0x91fd8ac0 RunCurrentEventLoopInMode +
264
5 com.apple.HIToolbox 0x91fd8154 ReceiveNextEventCommon + 380
6 com.apple.HIToolbox 0x91fd7fc0
BlockUntilNextEventMatchingListInMode + 96
7 com.apple.AppKit 0x924c0e44 _DPSNextEvent + 384
8 com.apple.AppKit 0x924c0b08 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 116
9 com.apple.AppKit 0x924bd06c -[NSApplication run] + 472
10 com.apple.AppKit 0x925ad8bc NSApplicationMain + 452
11 com.intuit.turbotaxupdater 0x00002a2c main + 64 (main.m:13)
12 com.intuit.turbotaxupdater 0x00002248 _start + 344 (crt.c:272)
13 com.intuit.turbotaxupdater 0x000020ec start + 60
Thread 1 Crashed:
0 <<00000000>> 0xffff87f0 __memcpy + 80 (cpu_capabilities.h:189)
1 ...ple.CoreServices.CarbonCore 0x90b29fbc
ConvertFSCatalogInfoToSearchInfo(VolumeInfo const*, unsigned long,
FSCatalogInfo const*, CatalogAttributeInfo*) + 96
2 ...ple.CoreServices.CarbonCore 0x90b29dac PBCatalogSearchSync + 244
3 ...ple.CoreServices.CarbonCore 0x90b6c5f8 AsyncFileThread(void*) + 180
4 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 2:
0 libSystem.B.dylib 0x90032008 pthread_cond_signal + 8
1 ...ple.CoreServices.CarbonCore 0x90b6c844 TSSignalSemaphore + 116
2 ...ple.CoreServices.CarbonCore 0x90b6c4cc DoAsyncFileRequest + 220
3 com.intuit.turbotaxupdater 0x000034b4 ThrFileSearch::search(void*)
+ 68 (ThrFileSearch.cpp:120)
4 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 1 crashed with PPC Thread State 64:
srr0: 0x00000000ffff87f0 srr1: 0x100000000000d030
vrsave: 0x0000000000000000
cr: 0x84000410 xer: 0x0000000000000000 lr: 0x0000000090b29fbc
ctr: 0x00000000901241c0
r0: 0x0000000090b29fbc r1: 0x00000000f0202620 r2: 0x0000000000000000
r3: 0x0000000000000058
r4: 0x0000000000000058 r5: 0x0000000000000010 r6: 0x00000000f0202c20
r7: 0x0000000000000000
r8: 0x0000000000000001 r9: 0x00000000f0202dac r10: 0x00000000003620f8
r11: 0x00000000a0afe7a8
r12: 0x00000000f0202c78 r13: 0x0000000000000000 r14: 0x0000000000000000
r15: 0x0000000000000000
r16: 0x0000000000000000 r17: 0x0000000000000000 r18: 0x0000000000000000
r19: 0x0000000000000000
r20: 0x0000000000000000 r21: 0x000000000030f8b0 r22: 0x0000000000362090
r23: 0x00000000f0202cf0
r24: 0x00000000f0202c30 r25: 0x0000000000362010 r26: 0x0000000000000038
r27: 0x000000000030f8b0
r28: 0x0000000000001200 r29: 0x0000000000000000 r30: 0x00000000f0202c30
r31: 0x0000000090b6c54c
The thing is that the thread that crashes is not the one we spin off.
AsyncFileThread(void*) is (I assume) Apple's private API.
PBCatalogSearchAsync is thread safe as of 10.0 so I don' t know what we are
doing to cause
the crash(I suppose calling some non-reentrant code)
Umed
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.