Re: dirty socket growth problem

Stuart <[email protected]> Wed, 4 Jan 2006 12:30:07 +0800
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
All,

Finally we solved this problem.  I mentioned in my original post that I had
added debug to our socket factories and it showed that when the growth
occurred it was not using our socket factories - I placed the debug in the
wrong place.  I should have put it in the accept method of the
MyServerSocket because obviously once RMI has a server socket it can keep
calling it to create more sockets.

Anyway we played around with the accept code and discovered:

// it is found if we invoke setSoTime or getSoTimeout before imp
lAccept
// the socket never got released by OS
// workaround is to create a plain socket and call setSoTimeout
after
// implAccpet returns
// Socket s = new MyClientSocket(); original code
Socket s = new Socket();
implAccept(s);
s.setSoTimeout(10*1000); <---- PROBLEM IF BEFORE immplAccept
return s;

This problem did not occur with JDK1.3.  Can anybody from the Sun RMI group
comment on this?

Thanks,

Stuart

-----Original Message-----
From: Stuart [mailto:[email protected]]
Sent: Monday, December 12, 2005 11:15 AM
To: [email protected]
Subject: Re: dirty socket growth problem

Greg/Niclas/all,

The netstat command (even with the -a option) does not show all the sockets
(although it does show some). However I am told that the growth we are
seeing using lsof -p is sockets:

java    4928 root   30u  IPv4 0x3000ea979a8       0t0    TCP *:* (IDLE)
java    4928 root   31u  IPv4 0x3000a8407d8       0t0    TCP *:* (IDLE)
java    4928 root   32u  IPv4 0x3000ea97ca8       0t0    TCP *:* (IDLE)
...

(I think the IPv4 indicates it is a socket)

I also doubt there is a problem with RMI but what I am seeing is very
strange i.e. The fact that I can get rid of the problem by using a large
lease time.  I have investigated our Socket Factories and close methods and
have been unable to find a problem --- I even tried to create a simple test
using the same Socket Factories but was unable to re-produce the problem.

Thanks for your help,

Stuart

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html