<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for using the PRF form. I found the change below in svn <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Johnny<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Courier New";
color:rosybrown'>Sat Mar 22 11:58:12 2003&nbsp; </span></b><b><span
style='font-size:10.0pt;font-family:"Courier New";color:cadetblue'>Douglas C.
Schmidt&nbsp; </span></b><span style='font-size:10.0pt;font-family:"Courier New"'>&lt;<span
style='color:darkgoldenrod'>schmidt@tango.doc.wustl.edu</span>&gt;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
<b><span style='color:blue'>ace/Message_Queue_T.cpp</span></b>: Moved the
notify() hook calls within<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
the protection of the guard lock critical section to prevent<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
race conditions on cleanup.&nbsp; Thanks to Ron Muck &lt;rlm@sdiusa.com&gt; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
for this suggestion.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
ace-bugs-bounces@cse.wustl.edu [mailto:ace-bugs-bounces@cse.wustl.edu] <b>On
Behalf Of </b>Rudy Pot<br>
<b>Sent:</b> Wednesday, February 27, 2008 11:29 AM<br>
<b>To:</b> ace-bugs@cs.wustl.edu<br>
<b>Subject:</b> [ace-bugs] [ACE_Message_Queue] notify PIPE block causes
Select_Reactor deadlock.<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
ACE VERSION: 5.5.6</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
HOST MACHINE and OPERATING SYSTEM: i386, Linux 2.6.20-1.2933.fc6 </span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
TARGET MACHINE and OPERATING SYSTEM, if different from HOST: same.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><br>
&nbsp;&nbsp;&nbsp; COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc 4.1.1</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
CONTENTS OF $ACE_ROOT/ace/config.h:&nbsp; config-linux.h</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU (unless<br>
&nbsp;&nbsp;&nbsp; this isn't used in this case, e.g., with Microsoft Visual
C++):<br>
&nbsp;&nbsp;&nbsp;&nbsp; platform-linux.GNU<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; AREA/CLASS/EXAMPLE AFFECTED: <br>
&nbsp;&nbsp;&nbsp; Message_Queue_T.cpp / ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;
/ enqueue_prio<br>
&nbsp;&nbsp;&nbsp; ( But I think also:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_head, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_deadline,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_tail )</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
See DESCRIPTION.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
DOES THE PROBLEM AFFECT:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMPILATION? NO<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINKING?&nbsp;&nbsp;&nbsp;&nbsp; NO<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXECUTION?&nbsp;&nbsp; YES<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHER (please specify)? NO</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
SYNOPSIS:<br>
&nbsp;&nbsp;&nbsp; Application sometimes hangs when main Reactor gets more
busy. <br>
&nbsp;&nbsp;&nbsp; (e.g. due to significant increasing external events)<br>
&nbsp;&nbsp;&nbsp; Coredump shows:<br>
&nbsp;&nbsp;&nbsp; 1) Main Reactor thread is blocking to get the
ACE_Message_Queue lock.<br>
&nbsp;&nbsp;&nbsp; 2) Multiple threads block on ACE_Select_Reactor_Notify-&gt;
which ends up in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt;ACE::send() -&gt; write().<br>
&nbsp;&nbsp;&nbsp; Result is deadlock. We have to kill the application for
shutdown.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
I've read Sidebar17 of C++ Network Programming Volume 2 but our situation <br>
&nbsp;&nbsp;&nbsp; is different from what is stated there (no notify called
from handle_* of<br>
&nbsp;&nbsp;&nbsp; event_handler but producer-consumer deadlock).</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
DESCRIPTION:</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
The application in short.<br>
&nbsp;&nbsp;&nbsp; -------------------------<br>
&nbsp;&nbsp;&nbsp; The part of our program where this deadlock appears is
dealing with <br>
&nbsp;&nbsp;&nbsp; processing messages from an embedded (CAN) network. <br>
&nbsp;&nbsp;&nbsp; There is a thread per CAN message center (hardware
communication channel)<br>
&nbsp;&nbsp;&nbsp; which puts the received message into ACE_Message_Queue's,
depending on who<br>
&nbsp;&nbsp;&nbsp; wants to observe the messages. These are the producer
threads.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
The message queues belongs to observers who all have registered to get<br>
&nbsp;&nbsp;&nbsp; notified by one Reactor which runs in one main Reactor thread
(consumer).<br>
&nbsp;&nbsp;&nbsp; (they also have registered themselves by the message center
threads as being<br>
&nbsp;&nbsp;&nbsp;&nbsp; interested in the messages).</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
Problem cause<br>
&nbsp;&nbsp;&nbsp; --------------<br>
&nbsp;&nbsp;&nbsp; What can happen now is that the main Reactor, which is used
for many other <br>
&nbsp;&nbsp;&nbsp; things in our application, temporarily got other work todo,
and therefore<br>
&nbsp;&nbsp;&nbsp; the message center threads may fill up the
ACE_Select_Reactor notification<br>
&nbsp;&nbsp;&nbsp; PIPE. This causes the message center threads (producers) to
block on the <br>
&nbsp;&nbsp;&nbsp; (FULL) PIPE write().</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
The main Reactor thread (consumer), when ready with the other work, wants to <br>
&nbsp;&nbsp;&nbsp; proceed with handling the pending notifications, and so
emptying the PIPE, <br>
&nbsp;&nbsp;&nbsp; but cannot do this because the current notification code
also holds the <br>
&nbsp;&nbsp;&nbsp; message QUEUE lock! <br>
&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; See code description below:</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
In Message_Queue_T.cpp<br>
&nbsp;&nbsp;&nbsp; ======================<br>
&nbsp;&nbsp;&nbsp; ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio,<br>
&nbsp;&nbsp;&nbsp; ( But also the code reveals:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_head, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_deadline,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::enqueue_tail )</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>-------------------------------<br>
DEADLOCK CODE: (Above rev. 46096 until HEAD code)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>template
&lt;ACE_SYNCH_DECL&gt; int<br>
ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio (ACE_Message_Block
*new_item,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ACE_Time_Value *timeout)<br>
{<br>
&nbsp; ACE_TRACE
(&quot;ACE_Message_Queue&lt;ACE_SYNCH_USE&gt;::enqueue_prio&quot;);<br>
&nbsp; int queue_count = 0;<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon,
this-&gt;lock_, -1);</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
if (this-&gt;state_ == ACE_Message_Queue_Base::DEACTIVATED)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errno = ESHUTDOWN;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
if (this-&gt;wait_not_full_cond (ace_mon, timeout) == -1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
queue_count = this-&gt;enqueue_i (new_item);</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
if (queue_count == -1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
this-&gt;notify ();&nbsp; &lt;&lt;&lt;&lt; ERROR DEADLOCK (When blocking on
notify in scope of <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
buffer lock...)<br>
&nbsp; }<br>
&nbsp; return queue_count;<br>
}</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
In above code snippet: <br>
&nbsp;&nbsp;&nbsp; this-&gt;notify (); Causes DEADLOCK when blocking on full
notification pipe.<br>
&nbsp;&nbsp;&nbsp; This happens because &lt;notify()&gt; is now called within
the scope of the <br>
&nbsp;&nbsp;&nbsp; ACE_GUARD_RETURN.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
In older versions of ACE, e.g. 5.3.1, the &lt;notify()&gt; was outside the
scope<br>
&nbsp;&nbsp;&nbsp; of the GUARD and we never had this deadlock.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
In SUBVERSION ACE, I can see this has been changed after revision<br>
&nbsp;&nbsp;&nbsp;&nbsp; r.46096 of Message_Queue_T.cpp (ChangeLogTag:Sat Mar
22 11:58:12 2003)<br>
&nbsp;&nbsp;&nbsp; But I don't know why.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
See Message_Queue_T.cpp <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : enqueue_prio, enqueue_head, enqueue_deadline,
enqueue_tail</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>-------------------------------<br>
NON DEADLOCK CODE (rev. 46096)<br>
&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if (queue_count == -1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;
}&nbsp; // e.o. scope ACE_GUARD_RETURN for queue lock.<br>
&nbsp; this-&gt;notify ();&nbsp; // NO deadlock here, notify will unblock as
soon PIPE is <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// emptied.<br>
&nbsp; return queue_count;<br>
}</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>-------------------------------<br>
Concerning Coredump parts:</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>[
consumer ]</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thread
1 (process 16785):<br>
#0&nbsp; 0x009bc5d9 in __lll_mutex_lock_wait () from /lib/libpthread.so.0<br>
#1&nbsp; 0x009b8636 in _L_mutex_lock_85 () from /lib/libpthread.so.0<br>
#2&nbsp; 0x009b817d in pthread_mutex_lock () from /lib/libpthread.so.0<br>
#3&nbsp; 0x00a9f922 in ACE_OS::mutex_lock () from /usr/lib/libACE.so.5.5.6<br>
#4&nbsp; 0x00fd83c8 in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::is_empty ()<br>
&nbsp;&nbsp; from /opt/lib/libgcp_datadump.so<br>
#5&nbsp; 0x0142d881 in can::CCanSvcDriverObserver::handle_output ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#6&nbsp; 0x00ac03f6 in ACE_Select_Reactor_Notify::dispatch_notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#7&nbsp; 0x00ac057a in ACE_Select_Reactor_Notify::handle_input ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#8&nbsp; 0x00ac14da in ACE_Select_Reactor_Notify::dispatch_notifications ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#9&nbsp; 0x00a5ef8e in ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#10 0x00a5f5fd in ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#11 0x00a65b03 in ACE_OS::gettimeofday () from /usr/lib/libACE.so.5.5.6<br>
#12 0x00abd0d3 in ACE_Reactor::run_reactor_event_loop ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#13 0x0804ae36 in main ()</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>[&nbsp;producer
]<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thread
28 (process 17023):<br>
#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<br>
#1&nbsp; 0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<br>
#2&nbsp; 0x00ac082e in ACE_Select_Reactor_Notify::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#3&nbsp; 0x00a5edcc in ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from /usr/lib/libACE.so.5.5.6<br>
#5&nbsp; 0x00abeace in ACE_Reactor_Notification_Strategy::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#6&nbsp; 0x0804b42a in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<br>
#7&nbsp; 0x00fd7fa2 in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<br>
&nbsp;&nbsp; from /opt/lib/libgcp_datadump.so<br>
#8&nbsp; 0x0142d6f3 in can::CCanSvcDriverObserver::update ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#9&nbsp; 0x0143078d in can::CCanSvcDriver_Base::svc_Read ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#10 0x0143087f in can::CCanSvcDriverRemoteRequestImpl::svc ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#11 0x00ad3026 in ACE_Task_Base::svc_run () from /usr/lib/libACE.so.5.5.6<br>
#12 0x00ad39e8 in ACE_Thread_Adapter::invoke_i ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from /usr/lib/libACE.so.5.5.6<br>
#14 0x00a67511 in ace_thread_adapter () from /usr/lib/libACE.so.5.5.6<br>
#15 0x009b626a in start_thread () from /lib/libpthread.so.0<br>
#16 0x92fff470 in ?? ()<br>
#17 0x92fff470 in ?? ()<br>
#18 0x92fff470 in ?? ()<br>
#19 0x92fff470 in ?? ()<br>
#20 0x00000000 in ?? ()</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>[&nbsp;producer
]<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thread
34 (process 17012):<br>
#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<br>
#1&nbsp; 0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<br>
#2&nbsp; 0x00ac082e in ACE_Select_Reactor_Notify::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#3&nbsp; 0x00a5edcc in ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from /usr/lib/libACE.so.5.5.6<br>
#5&nbsp; 0x00abeace in ACE_Reactor_Notification_Strategy::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#6&nbsp; 0x0804b42a in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<br>
#7&nbsp; 0x00fd7fa2 in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<br>
&nbsp;&nbsp; from /opt/lib/libgcp_datadump.so<br>
#8&nbsp; 0x0142d6f3 in can::CCanSvcDriverObserver::update ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#9&nbsp; 0x0143062b in can::CCanSvcDriver_Base::svc_Read ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#10 0x014308cd in can::CCanSvcDriverReadImpl::svc ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#11 0x00ad3026 in ACE_Task_Base::svc_run () from /usr/lib/libACE.so.5.5.6<br>
#12 0x00ad39e8 in ACE_Thread_Adapter::invoke_i ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from /usr/lib/libACE.so.5.5.6<br>
#14 0x00a67511 in ace_thread_adapter () from /usr/lib/libACE.so.5.5.6<br>
#15 0x009b626a in start_thread () from /lib/libpthread.so.0<br>
#16 0x96bff470 in ?? ()<br>
#17 0x96bff470 in ?? ()<br>
#18 0x96bff470 in ?? ()<br>
#19 0x96bff470 in ?? ()<br>
#20 0x00000000 in ?? ()</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>[&nbsp;producer
]<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thread
26 (process 17025):<br>
#0&nbsp; 0x009bc8f1 in write () from /lib/libpthread.so.0<br>
#1&nbsp; 0x00a55a3a in ACE::send () from /usr/lib/libACE.so.5.5.6<br>
#2&nbsp; 0x00ac082e in ACE_Select_Reactor_Notify::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#3&nbsp; 0x00a5edcc in ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task$base ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#4&nbsp; 0x00abdce6 in ACE_Reactor::notify () from /usr/lib/libACE.so.5.5.6<br>
#5&nbsp; 0x00abeace in ACE_Reactor_Notification_Strategy::notify ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#6&nbsp; 0x0804b42a in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::notify ()<br>
#7&nbsp; 0x00fd7fa2 in ACE_Message_Queue&lt;ACE_MT_SYNCH&gt;::enqueue_prio ()<br>
&nbsp;&nbsp; from /opt/lib/libgcp_datadump.so<br>
#8&nbsp; 0x0142d6f3 in can::CCanSvcDriverObserver::update ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#9&nbsp; 0x0143078d in can::CCanSvcDriver_Base::svc_Read ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#10 0x0143087f in can::CCanSvcDriverRemoteRequestImpl::svc ()<br>
&nbsp;&nbsp; from /opt/lib/libcanResourceManager.so.2<br>
#11 0x00ad3026 in ACE_Task_Base::svc_run () from /usr/lib/libACE.so.5.5.6<br>
#12 0x00ad39e8 in ACE_Thread_Adapter::invoke_i ()<br>
&nbsp;&nbsp; from /usr/lib/libACE.so.5.5.6<br>
#13 0x00ad3bb6 in ACE_Thread_Adapter::invoke () from /usr/lib/libACE.so.5.5.6<br>
#14 0x00a67511 in ace_thread_adapter () from /usr/lib/libACE.so.5.5.6<br>
#15 0x009b626a in start_thread () from /lib/libpthread.so.0<br>
#16 0x91bff470 in ?? ()<br>
#17 0x91bff470 in ?? ()<br>
#18 0x91bff470 in ?? ()<br>
#19 0x91bff470 in ?? ()<br>
#20 0x00000000 in ?? ()</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
REPEAT BY:<br>
&nbsp;&nbsp;&nbsp; See description</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;
SAMPLE FIX/WORKAROUND:<br>
&nbsp;&nbsp;&nbsp; Change ACE code so that &lt;this-&gt;notify();&gt; is
outside of GUARD scope?<br>
&nbsp;&nbsp;&nbsp; (like it was before in rev. 46096).</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>[*
end of PRF *]</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Aside
from this deadlock problem:</span><o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>One
thing what also comes up now is that I have to look at the notification pipe</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>buffer
length too when I want&nbsp;to increase the&nbsp; ACE_Message_Queue size?</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>(enqueue
will block if notification pipe is full). </span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Or,&nbsp;I
have to use #define ACE_HAS_REACTOR_NOTIFICATION_QUEUE and</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>recompile
ACE?</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Best
regards,</span><o:p></o:p></p>

</div>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<div>

<p class=MsoNormal><strong><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Rudy&nbsp;Pot</span></strong><o:p></o:p></p>

</div>

<div>

<div>

<div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Embedded
Computer Systems</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><strong><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>AWETA
G&amp;P b.v</span></strong><o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Postbox
17</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>NL-2630
AA&nbsp; Nootdorp</span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>tel
+31 (0)15 3109961 </span><o:p></o:p></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>fax&nbsp;+31
(0)15 3107321 </span><o:p></o:p></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>mail&nbsp;</span><a
href="mailto:rpot@aweta.nl"><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>rpot@aweta.nl</span></a><o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>web
<a href="blocked::http://www.aweta.com">www.aweta.com</a></span><o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</body>

</html>