Re: Socket Connections - never seem to close

Discussion in 'Java' started by Shripathi Kamath, Aug 9, 2003.

  1. "Jayaram" <> wrote in message
    news:...
    > 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
    Shripathi Kamath, Aug 9, 2003
    #1
    1. Advertising

  2. Shripathi Kamath

    Jayaram Guest

    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
    Jayaram, Aug 13, 2003
    #2
    1. Advertising

  3. Shripathi Kamath

    EJP Guest

    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
    EJP, Aug 14, 2003
    #3
  4. Shripathi Kamath

    Jayaram Guest

    EJP <> wrote in message news:<>...
    > 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
    Jayaram, Aug 14, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob
    Replies:
    2
    Views:
    557
    Angel Saenz-Badillos[MS]
    Feb 1, 2005
  2. Soren Kuula
    Replies:
    1
    Views:
    437
    Henry S. Thompson
    Dec 1, 2005
  3. Kevin
    Replies:
    4
    Views:
    410
    Irrwahn Grausewitz
    Oct 17, 2003
  4. Gen
    Replies:
    2
    Views:
    1,039
  5. Iñaki Baz Castillo
    Replies:
    7
    Views:
    820
    Iñaki Baz Castillo
    Jan 12, 2010
Loading...

Share This Page