<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><base href="x-msg://664/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I've changed the Subject: line of this email, because it's not clear what, if anything, your crash has to do with threads.<div><br></div><div><div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I pull and record from hundreds of cameras. Because of some OS limitaitions I can only wait on a maximum of 64 events.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">So I have threads called processors for each group of 60 sources. Each of these has their own UsageEnvironment and TaskScheduler and event loop.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Is this a reliable architecture?</div></div></div></blockquote><div><br></div>Yes, provided that *all* of the following are true:</div><div>1/ No thread ever accesses a "LIVE555" object that was created by another thread.  (The sole exception to this: A thread may call "triggerEvent()" on another thread's "TaskScheduler" object.)</div><div>2/ Your application code (that uses the LIVE555 libraries) is 'thread safe'.</div><div>3/ The system runtime library (that's used by both LIVE555 and your application code) is 'thread safe'.</div><div><br></div><div>That's why if you want to have multiple threads of control, it's better, if possible, to give each thread of control its own process, rather than having multiple threads of control running in the same process.</div><div><br></div><div><br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 11pt; ">today’s problem is distinctly different.</span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">It only occurs with one brand of camera.</div></div></div></blockquote><div><br></div>What kind of camera is this?  I.e., what codec(s) does it stream?  Is there anything 'distinct' about it?</div><div><br></div><div><br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">    Am I correct in assuming no camera, no matter how bad the stream, should be able to crash live555?</div></div></div></blockquote><div><br></div>Yes, of course.  Remember, though, that your application consists not just of the LIVE555 code, but also your application code, and the runtime libraries.  A bug in any one of these might cause a crash that could (e.g., because it steps on a wrong piece of memory) give the appearance of being in the LIVE555 code.</div><div><br></div><div><br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p><span style="font-size: 11pt; ">The access violation always occurs in the same location. </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "> On the delete packet; line of<o:p></o:p></div><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; position: static; z-index: auto; "> <span style="font-family: Consolas; ">ReorderingPacketBuffer::freePacket(BufferedPacket* packet){<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">    </span><span style="font-family: Consolas; color: blue; ">if</span><span style="font-family: Consolas; "> (packet != fSavedPacket) {<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">      </span><span style="font-family: Consolas; color: blue; ">delete</span><span style="font-family: Consolas; "> packet;<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">    } </span><span style="font-family: Consolas; color: blue; ">else</span><span style="font-family: Consolas; "> {<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">      fSavedPacketFree = True;<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">    }<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">  }<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; "> </span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; position: static; z-index: auto; "><span style="font-family: Consolas; ">In all inspections of memory the packet, whose pointer is not null, appears to already be destructed. The fBuf and vPtr are a special value 0xdddddddd which is Microsofts way of saying this memory was explicitly deleted.</span></pre></div></div></blockquote><div><br></div><div>Your first task should be to make sure that you're running the latest version of the LIVE555 code.  (I recently fixed a bug in the code that was causing symptoms similar (though not identical) to yours.)</div><div><br></div>Your second task, IMHO, should be to figure out if "packet" *really* has already been deleted.  One way to do this is to instrument both the constructor and destructor of "ReorderingPacketBuffer".  E.g., add something like</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>fprintf(stderr, "created ReorderingPacketBuffer:%p\n", this);</div><div>to the "ReorderingPacketBuffer" constructor, and</div><div><div><span class="Apple-tab-span" style="white-space: pre; ">     </span>fprintf(stderr, "deleting ReorderingPacketBuffer:%p\n", this);</div><div>to the "ReorderingPacketBuffer" destructor.  Then, looking at your log after the crash, you'll be able to tell whether or not "packet" points to an actual "ReorderingPacketBuffer" object that had already been deleted.</div><div><br></div><div>It's more likely, though, that "packet" will be a 'garbage' pointer - i.e., not pointing to a (currently or recently allocated) "ReorderingPacketBuffer".  If this is the case, then the bug is that something must have (erroneously) written on top of the pointer.</div><div><br></div><div><br></div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: Consolas; ">The call stack always shows we are a few frames down from MultiFramedRTPSource::networkReadHandler1() and I was trying to figure it out.<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; position: static; z-index: auto; "><span style="font-family: Consolas; ">I came across a question. Given the implementation of bytesAvailable() should the line “if bPacket->bytesavailable() == 0)…” be if bPacket->bytesavailable() <= 0)…”</span></pre></div></div></blockquote><div><br></div>No, because the "bytesAvailable()" function returns an unsigned value, i.e., always >= 0.  This is almost certainly a 'red herring'.</div><div><br></div><div><br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; position: static; z-index: auto; "><span style="font-family: Consolas; "><o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; position: static; z-index: auto; "><span style="font-family: Consolas; "> </span><span style="font-family: Consolas; background-color: white; font-size: 10pt; ">I am looking for suggestions on where to look for the source of this problem. Simple or scaled down examples do not have a problem.</span></pre></div></div></blockquote><div><br></div>Nonetheless, you should try to find the simplest possible environment that causes your crash.  First, you should make sure that the (unmodified) "testRTSPClient" demo application does not crash when it streams from this network camera.  Then, you should try running a single-threaded version of your application - first with just this single network camera as a source, then with more sources (up to your maximum of 60).  If the single-threaded version of your application crashes - even once - then you will know that multi-threading in your application is not to blame.</div><div><br></div><div>In any case, if the crash occurs only with your application (and not with (e.g.) "testRTSPClient"), then it's unlikely that I'll be able to debug it for free on this mailing list, unfortunately...</div></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>