realbasic-nug
[Top] [All Lists]

Re: Sockets in Carbon

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Sockets in Carbon
From: James Sentman <james at sentman dot com>
Date: Wed, 30 Jan 2002 20:40:52 -0500
There are definitely some issues with sockets under OSX that do not happen with sockets on OS9 which are really very solid for me anyway.

unfortunately the crash reports from OSX are not very helpful. In my case they show something different in each one, sometimes looking just like yours below, sometimes with pages of stuff that looks like it was trying to draw unicode stuff at the time of the crash. None show anything useful.

When running on OSX it's vital that you keep track of whether your sockets are open or closed and not call the close method when it's closed or more than once.

Especially in a timeout situation you may be calling close in some cleanup method. All sorts of interesting things happen if you call close more than once.

Walk the code and make sure that no matter what happens you're not closing the socket when it's not open. After my last post on this problem I have gotten emails from literally dozens of people that couldn't figure out why they were crashing and it turned out they were just calling close in a couple of different places. Which didn't cause any problems under OS9, but under OSX it's murder.

If this is not contributing to your problem I'd love to hear what you do discover. Even after fixing all these in one of my projects I've got a beta tester who is able to make it crash repeatedly on OSX, so there may be more issues, or I may have missed an extra call to close somewhere.

Good Luck,
 James


I just underwent a curious episode in which using sockets caused RB 4 Carbon to crash repeatedly, but not RB 4 Classic. We were having a problem with our router which caused it to slow to a crawl, causing lots of DNS timeouts (and generally mucking things up). So, the socket was unable to resolve an address to an IP number. This appears to have left something in a terribly unstable state, as the second time I would run my app in the IDE, it would crash -- not immediately, but soon after startup. The common thread, so to speak, among most crashes looked like

Thread 0:
 #0   0x70000978 in mach_msg_overwrite_trap
 #1   0x70005a04 in mach_msg
 #2   0x7017bf98 in __CFRunLoopRun
 #3   0x701b7100 in CFRunLoopRunSpecific
 #4   0x7017b8e0 in CFRunLoopRunInMode
 #5   0x7312cccc in RunEventLoopInModeUntilEventArrives
 #6   0x731c2ac4 in RunEventLoopUntilEventArrives
 #7   0x731a0950 in GetNextEventMatchingMask
 #8   0x731ad904 in WNEInternal
 #9   0x731c5474 in WaitNextEvent
 #10  0x00565650 in EventPump(void)
 #11  0x0057d600 in HandleEvents(void)
 #12  0x0057d98c in mainloop(void)
 #13  0x0057a1b8 in main


Unfortunately, I can't pin things down more precisely.

Charles Yeomans



---
Subscribe to the digest: <mailto:realbasic-nug-digest at lists dot realsoftware 
dot com>
Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>


--
_________________________________________________________________________
James Sentman <james at sentman dot com>                  http://www.sentman.com
  Enterprise server monitoring with:    http://whistleblower.sentman.com/


<Prev in Thread] Current Thread [Next in Thread>