ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> apache-soap-dev
apache-soap-dev
[jira] Commented: (SOAP-170) Socket is not closed after apache.axis SOAP call and resulted in too many CLOSE_WAIT state
by soap-dev other posts by this author
Oct 18 2006 3:50AM messages near this date
[jira] Created: (SOAP-170) Socket is not closed after apache.axis SOAP call and resulted in too many CLOSE_WAIT state | ezmlm warning
SERVICES     [ http://issues.apache.org/jira/browse/SOAP-170?page=comments#action_12443223 ]
 
            
Vincent Oostindië commented on SOAP-170:
----------------------------------------

I can confirm this issue. We have a web application that also acts as a client for a remote 
Web Service. The client was generated automatically, and uses Axis.

Every call to the remote service adds a new socket with state CLOSE_WAIT. It's just a matter
 of time before there are no longer any sockets available.

I've been able to reproduce the problem with Axis 1.3 and Axis 1.4.

The code from Jiping Yao resolves it. We've patched Axis 1.3, and now the problem doesn't oc
cur anymore.

>  Socket is not closed after apache.axis SOAP call and resulted in too many CLOSE_WAIT state
>  ------------------------------------------------------------------------------------------
> 
>                  Key: SOAP-170
>                  URL: http://issues.apache.org/jira/browse/SOAP-170
>              Project: SOAP
>           Issue Type: Bug
>          Environment: Both Windows and UNIX
>             Reporter: Jiping Yao
>             Priority: Critical
> 
>  I am not be able to send email to axis-dev@[...].org so I opend it as bug regport.
>  Currently, I ran into the problem with every socket not closed as shown by numerous SOCKET
_WAIT state after making SOAP call with apache.axis and those states are stayed there foreve
r.  Once we reach to the maximum number for SOCKET_WAIT state (operating system could not al
locate any more connections as indicated by Too many open files), we could not make any SOAP
 call until we restart JVM.
>  Here is the original code where "currentMessage = currMsg;" could cuases the sokcet leakin
g (see JYao's comment)
>  public class SOAPPart extends javax.xml.soap.SOAPPart implements Part
>  {
>  	.
>  	.
>  	.
>      private void setCurrentForm(Object currMsg, int form) {
>          if (log.isDebugEnabled()) {
>              String msgStr;
>              if (currMsg instanceof String) {
>                  msgStr = (String)currMsg;
>              } else {
>                  msgStr = currMsg.getClass().getName();
>              }
>              log.debug(Messages.getMessage("setMsgForm", formNames[form],
>                      "" + msgStr));
>          }
>          // only change form if allowed
>          if (isFormOptimizationAllowed()) {
>              currentMessage = currMsg;   // JYao's comment: socket is leaking here if curre
ntMessage was an instance of SocketInputStream.
>              currentForm = form;
>              if (currentForm == FORM_SOAPENVELOPE) {
>                      currentMessageAsEnvelope = (org.apache.axis.message.SOAPEnvelope) curr
Msg;
>              }
>          }
>      }
>  The following is what I changed for the same function within the block between of begin an
d end. After deployed recompiled code, all sockets allocated for apache.axix SOAP call are p
roperly closed and the CLOSE_WAIT state associated with SOAP call is no longer seen by netst
at -n in windows.
>  public class SOAPPart extends javax.xml.soap.SOAPPart implements Part
>  {
>  	.
>  	.
>  	.
>      private void setCurrentForm(Object currMsg, int form) {
>          if (log.isDebugEnabled()) {
>              String msgStr;
>              if (currMsg instanceof String) {
>                  msgStr = (String)currMsg;
>              } else {
>                  msgStr = currMsg.getClass().getName();
>              }
>              log.debug(Messages.getMessage("setMsgForm", formNames[form],
>                      "" + msgStr));
>          }
>          // only change form if allowed
>          if (isFormOptimizationAllowed()) {
>             
>  	// begin of JYao's change: 
>  	
>  	// currentMessage should be closed if it is an instance of SocketInputStream
>              // before to take any new instance of whatever SOAP message, otherwise the soc
ket might be leaked
>              if (currentMessage instanceof SocketInputStream)
>              {
>                  SocketInputStream socketInput = (SocketInputStream) currentMessage;
>                  try
>                  {
>                      socketInput.close();   // the socket is properly closed 
>                  }
>                  catch (IOException e)
>                  {
>                      // never got there
>                  }
>              } 
>  	// end of JYao's change
>              currentMessage = currMsg; // JYao: safely take any other SOAP message
>              currentForm = form;
>              if (currentForm == FORM_SOAPENVELOPE) {
>                      currentMessageAsEnvelope = (org.apache.axis.message.SOAPEnvelope) curr
Msg;
>              }
>          }
>      }
>      . 
>      .
>      .
>  }
>  I am not sure if this is a bug or intended by authors. If it is not a bug, please give us 
advice how to get those sockets closed after each SOAP call.
>  Thanks,
>  Jiping Yao

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache
.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-dev-unsubscribe@[...].org
For additional commands, e-mail: soap-dev-help@ws.apache.org
Thread:
Jiping Yao
soap-dev

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved