Re: crash in CFReadStreamOpen when called from secondary thread
Re: crash in CFReadStreamOpen when called from secondary thread
- Subject: Re: crash in CFReadStreamOpen when called from secondary thread
- From: "Shalini Kamala" <email@hidden>
- Date: Wed, 25 Oct 2006 16:00:20 -0700
- Organization: AOL
Hello,
Please find output from console below. The crash is in
CFAbsoluteTimeGetCurrent
(CFReadStreamOpen--> _CFStreamOpen --> httpRequestOpen -->
resetForRequest --> getConnectionForRequest -->
findOrCreateNetConnection --> _CFNetConnectionCreate -->
CFAbsoluteTimeGetCurrent)
Please let me know if you need any further details. I am new to Mac, so
I might miss something. Thanks for your help.
[Session started at 2006-10-25 15:50:18 -0700.]
GNU gdb 6.3.50-20050815 (Apple version gdb-563) (Wed Jul 19 05:10:58
GMT 2006)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-apple-darwin".
Loading program into debuggerÂ…
tty /dev/ttyp1
Program loaded.
sharedlibrary apply-load-rules all
(gdb) run
[Switching to process 2488 local thread 0xf03]
RunningÂ…
2006-10-25
15:50:22.108 Safari[2488] CFLog (0): CFMessagePort:
bootstrap_register(): failed 1103 (0x44f), port = 0x3103, name =
'com.apple.Safari.ServiceProvider'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2006-10-25 15:50:22.111 Safari[2488] CFLog (99):
CFMessagePortCreateLocal(): failed to name Mach port
(com.apple.Safari.ServiceProvider)
Pending breakpoint 1 - ""Uploader.c:441" resolved
Pending breakpoint 2 - ""Uploader.c:387" resolved
Pending breakpoint 3 - ""Uploader.c:227" resolved
Pending breakpoint 4 - ""Uploader.c:276" resolved
Pending breakpoint 5 - ""Uploader.c:403" resolved
Pending breakpoint 6 - ""Uploader.c:242" resolved
Pending breakpoint 7 - ""Uploader.c:269" resolved
Pending breakpoint 8 - ""Uploader.c:320" resolved
[Switching to process 2488 thread 0x89cb]
[Switching to process 2488 thread 0x89cb]
(gdb) continue
(gdb) continue
Program received signal: "EXC_ARITHMETIC".
(gdb)
Shalini Kamala wrote on 10/24/2006, 11:24 AM:
Hello!
I am trying to do an HTTP GET from a secondary thread, & when I
call CFReadStreamOpen, I get
a crash in the
debugger.("Program Received Signal: EXC_ARITHMETIC")
The crash occurs in _CFNetConnectionRegisterClass. If I call
CFReadStreamOpen from the main thread, it works fine. What am I missing
? Do I need to do any initialization in the secondary thread ?
Thanks,
Shalini
PS:
Here is how I create the thread :
MPCriticalRegionID
criticalRegion;
OSStatus retStatus = MPCreateCriticalRegion(&criticalRegion);
retStatus = MPEnterCriticalRegion(criticalRegion, 5000*2);
MPTaskID taskID;
retStatus = MPCreateTask(&ThreadFunc, strArray, 0, 0, NULL,
NULL, 0, &taskID);
retStatus = MPExitCriticalRegion(criticalRegion);
retStatus = MPDeleteCriticalRegion(criticalRegion);
My HTTP GET calls look like this:
CFStringRef
url
= "" href="http://10.169.150.209:8080/MetadataUploadServlet?Screenname=foo&Title=Testing&ThumbnailExtension=jpg">http://10.169.150.209:8080/MetadataUploadServlet?Screenname=foo&Title=Testing&ThumbnailExtension=jpg");
CFURLRef myURL = CFURLCreateWithString(kCFAllocatorDefault,
url, NULL);
CFStringRef requestMethod = CFSTR("GET");
CFHTTPMessageRef myRequest =
CFHTTPMessageCreateRequest(kCFAllocatorDefault, requestMethod, myURL,
kCFHTTPVersion1_1);
CFDataRef mySerializedRequest =
CFHTTPMessageCopySerializedMessage(myRequest);
CFReadStreamRef stream =
CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, myRequest);
CFStreamClientContext ctxt = { 0, (void*)NULL,
NULL, NULL, NULL };
CFReadStreamSetProperty(stream,
kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
CFReadStreamSetClient(stream, kNetworkEvents,
ReadStreamClientCallBack, &ctxt);
CFReadStreamScheduleWithRunLoop(stream,
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
CFReadStreamOpen(stream);
CFRelease(myRequest);
CFRelease(myURL);
CFRelease(url);
myRequest = NULL;
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden