Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Socket Connections - never seem to close

Reply
Thread Tools

Re: Socket Connections - never seem to close

 
 
Shripathi Kamath
Guest
Posts: n/a
 
      08-09-2003
"Jayaram" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> Hi,
> I have two JAVA applications one running on Sun Solaris 2.6 and the
> other running on HP-UX 11. The application running on HP-UX acts as a
> Server and listens at a pre-defined port waiting for client
> connections. The application on Solaris acts as a client and makes TCP
> Socket connections to the HP-UX Server application.
> I notice that even though the client application disconnects by
> explicitly invoking the java.net.Socket.close() method, the Server
> application (on HP-UX) does not seem to sense the client closure - it
> continues keeping the socket connection open.
> Running the 'netstat' command on the Server end shows the client
> socket connections in the ESTABLISHED state, whereas on the client end
> 'netstat' shows no trace of the socket connections.
> This problem occured only in the PRODUCTION environment - never
> happened in any of the test regions in the org I work for.
> We use JDK1.4 on both ends.
> It apparently looks like some problem with the kernel settings /
> kernel patches either on the Server or the Client end - unable to
> determine the exact cause of the problem.
> Has anyone ever faced anything similar to this before ?



Not really.

Some things to try:

- try the experiment(s) on a different platform (put the server on Solaris
as well, or put the client on Windows) to isolate the entity causing the
problem.
- run an independent set of TCP clients/servers such as a web browser/web
server to see if the issue persists.
- post snippets of code so that someone may help.
- use some packet capture utility to see if the close packet is being sent

--
Shripathi Kamath
NETAPHOR SOFTWARE INC.
http://www.netaphor.com


 
Reply With Quote
 
 
 
 
Jayaram
Guest
Posts: n/a
 
      08-13-2003
Hi,
I forgot to mention that the client application maintains a pool of
socket connections (that remain alive for a very long time - hours or
possibly even days) to the Server application.
On the client end after establishing the socket connection we enable
the SO_KEEPALIVE socket option by invoking the
java.net.Socket.setKeepAlive(boolean) method.
I know that there is a firewall between the client and server.

Is it possible that the 'keep alive' packets may not be reaching their
destination (being dropped of by the firewall) and hence causing the
problem ?

Regards,
Jayaram
 
Reply With Quote
 
 
 
 
EJP
Guest
Posts: n/a
 
      08-14-2003
Two comments.

1. As you have long-lived connections too, are you sure that the
connections which persist at the server really belong to sockets which
have been closed by the client?

2. If the keepalive packets weren't getting through, this would cause
the sockets to be reset by the keepalive sender. Do you enable keepalive
at the server end too?

EJP

Jayaram wrote:
>
> Hi,
> I forgot to mention that the client application maintains a pool of
> socket connections (that remain alive for a very long time - hours or
> possibly even days) to the Server application.
> On the client end after establishing the socket connection we enable
> the SO_KEEPALIVE socket option by invoking the
> java.net.Socket.setKeepAlive(boolean) method.
> I know that there is a firewall between the client and server.
>
> Is it possible that the 'keep alive' packets may not be reaching their
> destination (being dropped of by the firewall) and hence causing the
> problem ?
>
> Regards,
> Jayaram

 
Reply With Quote
 
Jayaram
Guest
Posts: n/a
 
      08-14-2003
EJP <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Two comments.
>
> 1. As you have long-lived connections too, are you sure that the
> connections which persist at the server really belong to sockets which
> have been closed by the client?
>

Yes...the socket connections do belong to the client...

> 2. If the keepalive packets weren't getting through, this would cause
> the sockets to be reset by the keepalive sender. Do you enable keepalive
> at the server end too?
>

No, keepalive is being enabled only on the client end.

> EJP
>
> Jayaram wrote:
> >
> > Hi,
> > I forgot to mention that the client application maintains a pool of
> > socket connections (that remain alive for a very long time - hours or
> > possibly even days) to the Server application.
> > On the client end after establishing the socket connection we enable
> > the SO_KEEPALIVE socket option by invoking the
> > java.net.Socket.setKeepAlive(boolean) method.
> > I know that there is a firewall between the client and server.
> >
> > Is it possible that the 'keep alive' packets may not be reaching their
> > destination (being dropped of by the firewall) and hence causing the
> > problem ?
> >
> > Regards,
> > Jayaram

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a TCP socket? (TCPSocket#close doesn't close it) IƱaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
Firebird connection pools never close connections idle for a long time Gen ASP .Net 2 08-22-2006 06:20 AM



Advertisments