• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Thread issue - sure can use some help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread issue - sure can use some help


  • Subject: Re: Thread issue - sure can use some help
  • From: Jeff Moore <email@hidden>
  • Date: Thu, 6 Apr 2006 12:29:28 -0700

The crash looks to me like your thread is trying to message a bad ObjC object. That implies some kind of data coherency issue in your code. My guess is that you have one thread that is disposing of an object while another thread is trying to use it.

The hang is a deadlock of some flavor. This means that one thread is blocking while holding onto a lock that is blocking the other thread while it tries to acquire the lock.

Both problems are pretty basic parallel programming problems that unfortunately, have no set answers. The solution is going to be totally driven by the context. You need to look very closely at how the various threads interact with your data and design a locking solution that ensures that things like this don't happen while at the same time allowing the code to still be able to satisfy the real time demands of the audio system (ie. make the deadlines and don't block the IO thread, ever).

On Apr 6, 2006, at 3:23 AM, John Draper wrote:

Hi,

I've also CC'ed this to both Core Audio and the Multi-processing list, in the
hopes that someone can give me a clue on what's going on.


First the forplay...

* Using a C++ library (JRTPLIB) a real time transport for VIOP packets, which
uses it's own thread. This thread is not an NSThread, and I have my application
running in Multi-processing mode, so I can make Autorelease pools for this thread
and others.


* This thread calls methods in MTCoreAudio, an Obj C wrapper around the
lower level Core Audio. This is available on the net from 3rd party.


* Program will either hang up in the Mutex.lock() part of the thread in
question above, or crash....


Crash log here....

Thread 6 Crashed:
0 libobjc.A.dylib 0x908311e8 objc_msgSend + 0x8
1 com.apple.Foundation 0x90a06320 - [NSConcreteMutableData appendData:] + 0x2c
2 com.apple.myCocoaApp 0x00023598 -[VIOPAudioMonitor _flushDataForConverter:] + 0x100 (VIOPAudioMonitor.m:251)
3 com.apple.myCocoaApp 0x00023398 -[VIOPAudioMonitor flushOutput:] + 0x7c (VIOPAudioMonitor.m:231)
4 com.apple.myCocoaApp 0x000237b4 -[VIOPAudioMonitor queueAudioSampleData:] + 0x7c (VIOPAudioMonitor.m:274)
5 com.apple.myCocoaApp 0x00037f68 -[AudTransport processIncomingData:] + 0x8c (AudTransport.m:76)
6 com.apple.myCocoaApp 0x0000c6ec -[RTPSessionBridge incomingPacket:ofLength:] + 0x80 (RTPSessionBridge.mm:183)
7 com.apple.myCocoaApp 0x0000b788 MyRTPSession::ProcessRTPPacket(RTPSourceData const&, RTPPacket const&) + 0x74 (myRTPSession.cpp:84)
8 com.apple.myCocoaApp 0x0000b6a0 MyRTPSession::OnPollThreadStep() + 0x17c (myRTPSession.cpp:55)
9 com.apple.myCocoaApp 0x001b5820 RTPPollThread::Thread () + 0x254 (rtppollthread.cpp:158)
10 com.apple.myCocoaApp 0x001c9650 JThread::TheThread (void*) + 0xac (jthread.cpp:152)
11 libSystem.B.dylib 0x900246e8 _pthread_body + 0x28


Since none of this stuff is secret (It's a SIP phone for the Mac), I don't mind sharing the code
with anyone willing to help me out.


The SIP phone works now, but ONLY for about a minute then either locks up or crashes, depending on
the phase of the moon, or topical strata :-)


The JThread basically receives UDP Packet data via the Posix "recvfrom" API in "OnPollThreadStep"
which eventually calls ProcessPacket.


Through process elimination, I selectively commented out portions of the code to try and
determine which one causes it to hang, and determined the "[VIOPAudioMonitor queueAudioSampleData:]";
method is the culprit.


Can someone please tell me how I can make this code "Thread safe" when it calls something
I know nothing about (MTCoreAudio framework).... the "AudTransport" is a delegate of the
VIOPAudioMonitor, which is my AudioMonitor Delegate. Like I said, if anyone is willing to help
me on this, I can send you the project, if you still use X-Code 1.5. yea - I know, I should
upgrade, and eventually hope to do so soon, but not until I can afford to get a better machine
that will support OS-X 10.4...


I don't have the disk space to upgrade to 10.4 right now.

Can someone help me please?

John



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


--

Jeff Moore
Core Audio
Apple


_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Thread issue - sure can use some help
      • From: John Draper <email@hidden>
References: 
 >Thread issue - sure can use some help (From: John Draper <email@hidden>)

  • Prev by Date: Re: AULab and generators
  • Next by Date: mp3 AudioConverter hangs
  • Previous by thread: Thread issue - sure can use some help
  • Next by thread: Re: Thread issue - sure can use some help
  • Index(es):
    • Date
    • Thread