<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff size=2>Hi 
John,</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff size=2>I 
strongly recommend you get the HP aC++ compiler for HP-UX. It has no problems, 
while g++ on HP-UX seems to continually exhibit these odd types of 
issues.</FONT></SPAN></DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff size=2>If you 
need to use g++, feel free to contact me to discuss how we may be able to 
help.</FONT></SPAN></DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff size=2>Best 
regards,</FONT></SPAN></DIV>
<DIV><SPAN class=294582115-14062007><FONT face=Arial color=#0000ff 
size=2>-Steve</FONT></SPAN></DIV><!-- Converted from text/plain format -->
<P><FONT size=2>--<BR>Steve Huston, Riverace Corporation<BR>Would you like ACE 
to run great on your platform?<BR>See <A 
href="http://www.riverace.com/sponsor.htm">http://www.riverace.com/sponsor.htm</A><BR></FONT></P>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  ace-users-bounces@cse.wustl.edu [mailto:ace-users-bounces@cse.wustl.edu] <B>On 
  Behalf Of </B>John Jenniskens<BR><B>Sent:</B> Thursday, June 14, 2007 10:31 
  AM<BR><B>To:</B> ace-users@cse.wustl.edu<BR><B>Subject:</B> [ace-users] HP-UX 
  Itanium: TCP/IP connections stay in CLOSE_WAITstate.<BR><BR></FONT></DIV><FONT 
  face=Tahoma size=2>
  <DIV><BR>ACE VERSION 5.4 and 5.5<BR>&nbsp;<BR>HOST MACHINE and OPERATING 
  SYSTEM<BR>&nbsp;HP&nbsp; HP-UX 11.23 on Itanium Platform&nbsp; (HP-UX&nbsp; 
  B.11.23 U ia64)<BR>&nbsp;<BR>Compiler GCC 4.0.2 (With patches suplied by HP 
  for wstring support)<BR>&nbsp;<BR>$ACE_ROOT/ace/config.h:<BR>#ifndef 
  ACE_CONFIG_H<BR>// ACE_CONFIG_H is defined in the included header</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#undef ACE_BUILD_DLL<BR>#ifndef ACE_AS_STATIC_LIBS<BR>#define 
  ACE_AS_STATIC_LIBS<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#ifndef HPUX_VERS<BR>#define HPUX_VERS 1123<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#ifndef ACE_HAS_THREADS<BR>#define ACE_HAS_THREADS 1<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#ifndef _POSIX_C_SOURCE<BR>#define _POSIX_C_SOURCE 
199506L<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#ifndef ACE_HAS_EXCEPTIONS<BR>#define ACE_HAS_EXCEPTIONS<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#ifndef __ACE_INLINE__<BR>#define __ACE_INLINE__<BR>#endif</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#include &lt;ace/config-hpux-11.00.h&gt;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>#endif&nbsp; // ACE_CONFIG_H</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>$ACE_ROOT/include/makeinclude/platform_macros.GNU:<BR>static_libs_only 
  = 1<BR>CPPFLAGS += -fPIC<BR>include 
  $(ACE_ROOT)/include/makeinclude/platform_hpux_gcc.GNU</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>THE PROBLEM AFFECTS: EXECUTION</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; SYNOPSIS:<BR>TCP/IP connections stay in CLOSE_WAIT 
  state.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; DESCRIPTION:<BR>We implemented a server using the 
  ACE_Svc_Handler&lt;ACE_SOCK_STREAM, ACE_NULL_SYNCH&gt;. The implementation 
  works fine on different platforms, but on itanium, connections closed by the 
  client stay in the CLOSE_WAIT state (netstat). Every closed connection adds a 
  new CLOSE_WAIT. Resources are limited, so after some time we are forced to 
  restart the server.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Our analysis:</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; Normal behaviour:</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; Svc_Handler.cpp<BR>&nbsp; ::operator new gets a dynamic_instance 
  by calling ACE_Dynamic::instance()<BR>&nbsp; and calls set() upon the 
  dynamic_instance and thereby setting its value to 1</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; The ACE_Svc_Handler constructor assigns the value<BR>&nbsp; 
  ACE_Dynamic::instance ()-&gt;is_dynamic () to the dynamic_ data member of 
  this<BR>&nbsp; ACE_Svc_Handler.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; The ACE_Svc_Handler::destroy() method checks the 
  ACE_Svc_Handler::dynamic_<BR>&nbsp; data member and deletes this 
  ACE_Svc_Handler in case it has value 1</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>&nbsp; But in case of the itanium:</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; The call ACE_Dynamic::instance() in the ACE_Svc_Handler 
  constructor creates<BR>&nbsp; a new instance in stead of using the instance 
  initialized in the<BR>&nbsp; ::operator new. So, the dynamic_<BR>&nbsp; member 
  gets a value 0. And this prevents the destroy method calling delete.<BR>&nbsp; 
  And now the TCP/IP handle is not closed, resulting in a CLOSE_WAIT.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp; It looks like the ACE_Dynamic::instance implemented with a 
  ACE_TSS_Singleton<BR>&nbsp; does not work correctly.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>&nbsp;&nbsp;&nbsp; REPEAT BY:<BR>I added print statements printing 
  the address of the dynamic instance in ace/Dynamic.i and ace/Svc_Handler.cpp. 
  This<BR>shows the problem in the ace/tests/Svc_Handler_Test.cpp for ACE 
  5.4</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Index: 
  Dynamic.i<BR>===================================================================<BR>--- 
  Dynamic.i&nbsp;&nbsp; (revision 19207)<BR>+++ Dynamic.i&nbsp;&nbsp; (working 
  copy)<BR>@@ -3,10 +3,13 @@</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;// Dynamic.i</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>+#include 
  &lt;iostream&gt;<BR>+<BR>&nbsp;ACE_INLINE<BR>&nbsp;ACE_Dynamic::~ACE_Dynamic 
  (void)<BR>&nbsp;{<BR>&nbsp;&nbsp; // ACE_TRACE 
  ("ACE_Dynamic::~ACE_Dynamic");<BR>+&nbsp; std::cout &lt;&lt; this &lt;&lt; " 
  ACE_Dynamic::~ACE_Dynamic" &lt;&lt; std::endl;<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;ACE_INLINE void<BR>@@ -14,12 +17,14 @@<BR>&nbsp;{<BR>&nbsp;&nbsp; 
  // ACE_TRACE ("ACE_Dynamic::set");<BR>&nbsp;&nbsp; this-&gt;is_dynamic_ = 
  1;<BR>+&nbsp; std::cout &lt;&lt; this &lt;&lt; " ACE_Dynamic::set" &lt;&lt; 
  std::endl;<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;ACE_INLINE int<BR>&nbsp;ACE_Dynamic::is_dynamic 
  ()<BR>&nbsp;{<BR>&nbsp;&nbsp; // ACE_TRACE 
  ("ACE_Dynamic::is_dynamic");<BR>+&nbsp; std::cout &lt;&lt; this &lt;&lt; " 
  ACE_Dynamic::is_dynamic " &lt;&lt; this-&gt;is_dynamic_ &lt;&lt; 
  std::endl;<BR>&nbsp;&nbsp; return this-&gt;is_dynamic_;<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>@@ -28,4 +33,5 @@<BR>&nbsp;{<BR>&nbsp;&nbsp; // ACE_TRACE 
  ("ACE_Dynamic::reset");<BR>&nbsp;&nbsp; this-&gt;is_dynamic_ = 0;<BR>+&nbsp; 
  std::cout &lt;&lt; this &lt;&lt; " ACE_Dynamic::reset" &lt;&lt; 
  std::endl;<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>Index: 
  Svc_Handler.cpp<BR>===================================================================<BR>--- 
  Svc_Handler.cpp&nbsp;&nbsp;&nbsp;&nbsp; (revision 19207)<BR>+++ 
  Svc_Handler.cpp&nbsp;&nbsp;&nbsp;&nbsp; (working copy)<BR>@@ -15,6 +15,8 
  @@</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;#include "ace/Dynamic.h"</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>+#include "iostream"<BR>+<BR>&nbsp;ACE_RCSID(ace, Svc_Handler, 
  "Svc_Handler.cpp,v 4.69 2004/01/05 22:57:06 shuston Exp")</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;#define PR_ST_1 ACE_PEER_STREAM_1<BR>@@ -44,6 +46,7 
  @@<BR>&nbsp;&nbsp; ACE_TRACE ("ACE_Svc_Handler&lt;PR_ST_2, 
  ACE_SYNCH_USE&gt;::operator new");</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance 
  ();<BR>+&nbsp; std::cout &lt;&lt; "new: dynamic_instance = "&lt;&lt; 
  dynamic_instance &lt;&lt; std::endl;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; if (dynamic_instance == 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  {<BR>@@ -72,6 +75,7 @@<BR>&nbsp;&nbsp; ACE_TRACE ("ACE_Svc_Handler&lt;PR_ST_2, 
  ACE_SYNCH_USE&gt;::operator new(nothrow)");</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance 
  ();<BR>+&nbsp; std::cout &lt;&lt; "new2: dynamic_instance = "&lt;&lt; 
  dynamic_instance &lt;&lt; std::endl;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; if (dynamic_instance == 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  {<BR>@@ -100,12 +104,15 @@</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; // Only delete ourselves if we're not owned by a module and 
  have<BR>&nbsp;&nbsp; // been allocated dynamically.<BR>+&nbsp; std::cout 
  &lt;&lt; "destroy: dynamic_ = " &lt;&lt; this-&gt;dynamic_ &lt;&lt; 
  std::endl;<BR>&nbsp;&nbsp; if (this-&gt;mod_ == 0 &amp;&amp; this-&gt;dynamic_ 
  &amp;&amp; this-&gt;closing_ == 0)<BR>+&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp; // 
  Will call the destructor, which automatically calls 
  &lt;shutdown&gt;.<BR>&nbsp;&nbsp;&nbsp;&nbsp; // Note that if we are *not* 
  allocated dynamically then the<BR>&nbsp;&nbsp;&nbsp;&nbsp; // destructor will 
  call &lt;shutdown&gt; automatically when it gets 
  run<BR>&nbsp;&nbsp;&nbsp;&nbsp; // during cleanup.<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
  delete this;<BR>+&nbsp; }<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;template &lt;PR_ST_1, ACE_SYNCH_DECL&gt; void<BR>@@ -142,10 +149,13 
  @@<BR>&nbsp;&nbsp; // work correctly in multi-threaded programs by using our 
  ACE_TSS<BR>&nbsp;&nbsp; // class.<BR>&nbsp;&nbsp; this-&gt;dynamic_ = 
  ACE_Dynamic::instance ()-&gt;is_dynamic ();<BR>+&nbsp; std::cout &lt;&lt; 
  "construct: dynamic_ = " &lt;&lt; this-&gt;dynamic_ &lt;&lt; std::endl;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; if (this-&gt;dynamic_ != 0)<BR>+&nbsp; 
  {<BR>&nbsp;&nbsp;&nbsp;&nbsp; // Make sure to reset the 
  flag.<BR>&nbsp;&nbsp;&nbsp;&nbsp; ACE_Dynamic::instance ()-&gt;reset 
  ();<BR>+&nbsp; }<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;// Default behavior for a ACE_Svc_Handler object is to be 
  registered</DIV>
  <DIV>&nbsp;</DIV>
  <DIV></FONT>&nbsp;</DIV>
  <DIV><FONT face=Tahoma size=2><SPAN class=450535308-14062007>Kind 
  regards,</SPAN></FONT></DIV>
  <DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV><FONT face=Georgia size=2>
  <DIV><FONT face=Georgia></FONT></DIV>
  <DIV><FONT face=Tahoma>John Jenniskens 
</FONT></DIV></BLOCKQUOTE></FONT></BODY></HTML>