Submitted On 08-AUG-2005
kpgidley
This bug is NOT fixed - nor are the related bugs that are also marked closed.
Submitted On 07-FEB-2006
curiousmetoo
We have opened a ticket with Sun on this - this should not be closed. We need to have a patch for this on JDK 1.5 and JDk 1.4 as needed.
Submitted On 08-FEB-2006
javaguyaimfi
Is there going to be a patch for 1.5? At least the 1.5.0_06 is still broken? (with linux)
I guess we can all stop talking about high performance java webservers?
Submitted On 08-FEB-2006
curiousmetoo
This is a serious problem for us as it causes the app server to run out of sockets!
Apparently this has been fixed now on 1.5.07 and scheduled to be released on 4/24/06.
Hopefully this major bug can be fixed earlier via patch update. We cannot really wait until 4/24/06.
Submitted On 28-FEB-2006
Why is this bug and the related bugs closed? this bug isn't fixed. Under linux there are CLOSE_WAITs and not disappearing pipes and sockets, which you can see if you have a look to /proc/processID/fd...
what's going on?
Submitted On 01-MAR-2006
alan.bateman
The bug is fixed in mustang and also in 5.0u7. Since 5.0u7 isn't available yet can you verify that the issue does not duplicate with mustang?
Submitted On 06-MAR-2006
joshberry
Is there a plan for fixing this in the 1.4.2 code base? Are there any suggested methods of avoiding the issue?
Thanks,
Submitted On 06-APR-2006
The issue is still seen with 1.5.0_01 on solaris sparc
Do we have a patch ?
Submitted On 17-MAY-2006
sbidondo
Echo the 1.4.2 comments. Where are we with 1.4.2 fixes or workarounds?
Submitted On 05-JUN-2006
sbidondo
I'm seeing the bug still appearing in 1.4.2_12 and 1.5.0_7 (Solaris). Can anyone else confirm?
Submitted On 21-JUN-2006
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_07-b03, mixed mode)
SuSE 10.1 AMD 64
Still seeing this bug. Web server is leaking sockets.
Submitted On 21-JUN-2006
in fact, to be more precise (my post was the SuSE 10.1 above)
lsof reports:
java 5892 root 6u sock 0,4 21604 can't identify protocol
java 5892 root 58u sock 0,4 21965 can't identify protocol
java 5892 root 83u sock 0,4 21833 can't identify protocol
Submitted On 31-JUL-2006
andys180274
This bug seems not to be closed. If we ar making a socket connection to localhost, to check the running web service from within the JVM, then there are remaining file descriptor's leaks:
Running on 1.50_07 on Redhat Linux 9:
>lsof -p 32190
[...]
java 32190 root 214u IPv4 -166566432 TCP *:9001 (LISTEN)
java 32190 root 215u IPv4 -166566435 TCP *:8001 (LISTEN)
java 32190 root 216r FIFO 0,5 4128400865 pipe
java 32190 root 217w FIFO 0,5 4128400865 pipe
java 32190 root 218u IPv4 -166533668 TCP localhost:44849->localhost:9001 (CLOSE_WAIT)
java 32190 root 219u IPv4 -166566427 TCP *:9002 (LISTEN)
java 32190 root 220r FIFO 0,5 4128400870 pipe
java 32190 root 221w FIFO 0,5 4128400870 pipe
java 32190 root 222u IPv4 -166566425 TCP *:9000 (LISTEN)
java 32190 root 223r FIFO 0,5 4128400872 pipe
java 32190 root 224w FIFO 0,5 4128400872 pipe
java 32190 root 225u IPv4 -166501833 TCP localhost:44876->localhost:9000 (CLOSE_WAIT)
java 32190 root 226u IPv4 -166501829 TCP localhost:44877->localhost:9001 (CLOSE_WAIT)
java 32190 root 227u IPv4 -166501824 TCP localhost:44878->localhost:9002 (CLOSE_WAIT)
java 32190 root 228u IPv4 -166470458 TCP localhost:44903->localhost:9000 (CLOSE_WAIT)
java 32190 root 229u IPv4 -166470453 TCP localhost:44904->localhost:9001 (CLOSE_WAIT)
java 32190 root 230u IPv4 -166533661 TCP localhost:44850->localhost:9002 (CLOSE_WAIT)
java 32190 root 231u IPv4 -166470443 TCP localhost:44907->localhost:9002 (CLOSE_WAIT)
java 32190 root 232u IPv4 -166440129 TCP localhost:44930->localhost:9000 (CLOSE_WAIT)
java 32190 root 233u IPv4 -166533659 TCP localhost:44851->localhost:9000 (CLOSE_WAIT)
java 32190 root 234u IPv4 -166440124 TCP localhost:44931->localhost:9001 (CLOSE_WAIT)
java 32190 root 235u IPv4 -166438611 TCP localhost:44934->localhost:9002 (CLOSE_WAIT)
java 32190 root 236u IPv4 -166408735 TCP localhost:44960->localhost:9000 (CLOSE_WAIT)
java 32190 root 237u IPv4 -166408723 TCP localhost:44963->localhost:9001 (CLOSE_WAIT)
java 32190 root 238u IPv4 -166407216 TCP localhost:44964->localhost:9002 (CLOSE_WAIT)
Submitted On 08-AUG-2006
ytrewq
same here,
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode)
on RedHat ES 3.0
this bug should not be closed. any way to reopen this?
Submitted On 14-SEP-2006
MartinAlfke
I can confirm that this bug still exists with jdk 1.5.0_08 on Linux.
Submitted On 02-OCT-2006
Despite claiming to be fixed (yet again) in 1.5.0_09, I'm still seeing the issue on a RHEL4 system.
Linux 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
Submitted On 02-OCT-2006
To elaborate on my posting from earlier today, in my environment anyway, this issue seems to be tied to the type of garbage collection that takes place. In a relatively idle system that repeatedly polls a deployment server for new artifacts, eventually I'll drain the avialable file descriptors for the process leaving the VM wedged and unable to respond to new requests or make further polling efforts. However, if I put the system under load such that full GCs are taking place, the FDs are cleaned during the full GC.
I've also confirmed this behavior by leaving the system idle long enough to accumulate several 100 CLOSE_WAIT sockets, then attaching a jconsole, invoking a full GC, then seeing CLOSE_WAIT sockets go to 0.
Given the nature of this application, it's possible that it sits idle for extended periods of time never producing enough activity for a full GC and ultimately hiting the process limits. Although I suppose I could up the ulimit for the process, that's not really adressing the problem.
Submitted On 06-OCT-2006
andys180274
Hi folks,
I figured out a workaround on my machine (Linux 2.4, JVM 1.5.0_08). The idea behind is that I read on the selector after closing the channel. This causes the TCP states to exchange.
Maybe you can try?
This is my selector close method:
private void close() throws IOException {
_isrunning = false;
_state = STATE_CLOSING;
while ( _state == STATE_CLOSING ) {
int n = _selector.select( 500 );
if ( _selector.keys().isEmpty() ) {
// Now we can finally close
_state = STATE_CLOSED;
}
else {
// read again for shutdown state exchange
int numbytes = readChannel();
if ( numbytes == -1 ) {
// Channel is definitly closed
_channel.close();
}
}
}
_selector.close();
_selector = null;
}
Submitted On 12-OCT-2006
it's not fixed nor on 1.4.* neither on 1.5.* and caused serious problem in intensive environment with high network load. also, this bug is applied to DatagramSocketChannel. once DatagramSocketChannel.socket() is called another file descriptor is reserved. even more, after this call close method on channel doesn't free its own file handler so with each call system leaks 2 fd's.
please reopen this and fix it.
Submitted On 13-OCT-2006
The fd leakage problem when using DatagramSocketChannel.socket() has been fixed in JDK6 and 5.0u7 (5.0 updated release 7), which is traced under #6246565. Please let me know if you still see the leak in 5.0u7 (appreciate if you can attach a test case).
As I mentioned above (in Evaluation), a number of developers have posted comments suggesting that this bug has not been fixed, though we've verified that the test case attached in this bug report no longer causes fd leakage and believe the channel leakage issue has been fixed, we are interested to see if we are missing anything here (and will fix it if we do stil have an issue), so please post a test case or leave us an email address so we can followup. I included my email address just in case you want to talk to me directly.
Btw, does the suggested workaround post on Oct.2th suggest that you are not explicitly closing the socketchannel and expecting the vm will close it "automately" after you closed the selector? just in case my wild guess is correct , yes, the channel needs to be closed explicitly.
Xueming
Submitted On 13-OCT-2006
Seems like the "include a link with my name&email" does not mean it will figure out my email address and attach it automately:-) Here we go "xueming.shen@sun.com"
Submitted On 17-OCT-2006
There is a simple workaround for this kind of problem.
Call
sChannel.socket().shutdownInput();
sChannel.socket().shutdownOutput();
before calling
sChannel.close();
Tiberiu Covaci
BEA JRockit (R) engineer
Submitted On 13-NOV-2006
qu1ck
I'm seeing fd leaks also in 5u9.
I also have a process that is idle for long periods, occasionally polling another server via a socket connection. Although I close the socket (and also shutdown input & output first). And null everything, I still see fd leakage after every polling, seems to be 3 fd per poll for some reason.
Linux white 2.6.16.13-4-smp #1 SMP Wed May 3 04:53:23 UTC 2006 i686 athlon i386 GNU/Linux
java version "1.5.0_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03)
Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
Submitted On 13-NOV-2006
qu1ck
email for followup on last post.
peter_bridge at hotmail.com
Submitted On 14-DEC-2006
gflyer
Fixed in JDK 5.0 u10:
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Server VM (build 1.5.0_10-b03, mixed mode)
Submitted On 18-JAN-2007
I still see a similar issue even with JDK 5.0 u10. The socket does get closed (disappears with netstat), but lsof shows two pipes still in existence and also the IPv6 / TCP line becomes unix/socket and the three descriptors never get cleaned up. Here's a partial lsof listing:
java 16772 bgroves 73u unix 0x00000102122cf380 752076 socket
java 16772 bgroves 74r FIFO 0,7 758045 pipe
java 16772 bgroves 75w FIFO 0,7 758045 pipe
java 16772 bgroves 76u unix 0x00000102122cf380 752076 socket
java 16772 bgroves 77r FIFO 0,7 758347 pipe
java 16772 bgroves 78w FIFO 0,7 758347 pipe
java 16772 bgroves 79u unix 0x00000102122cf380 752076 socket
java 16772 bgroves 80r FIFO 0,7 758679 pipe
java 16772 bgroves 81w FIFO 0,7 758679 pipe
java 16772 bgroves 82u IPv6 758680 TCP manassas:40170->manassas:51872 (ESTABLISHED)
This occurs any time the remote client drops the link (either gracefully via close() or going down hard). Here is the cleanup code which doesn't really clean up:
public void disconnect() {
System.out.println("Disconnecting");
try {
if (mAcceptingConnector != null) {
mAcceptingConnector.close();
mAcceptingConnector = null;
}
} catch (Exception e) {
System.out.println("Exception " + e
+ " occurred while closing accepting connector");
}
try {
if (mUpstreamServerSocketChannel != null) {
mUpstreamServerSocketChannel.close();
mUpstreamServerSocketChannel = null;
}
} catch (Exception e) {
System.out.println("Exception " + e
+ " occurred while closing upstream server socket channel");
}
try {
if (mUpstreamSocketChannel != null) {
Socket actualSocket = mUpstreamSocketChannel.socket();
if (actualSocket != null) {
InputStream is = null;
OutputStream os = null;
try {
is = actualSocket.getInputStream();
} catch (Exception e) {
System.out.println("Exception " + e + " occurred getting input stream to close");
}
try {
os = actualSocket.getOutputStream();
} catch (Exception e) {
System.out.println("Exception " + e + " occurred getting output stream to close");
}
if (is != null) {
is.close();
} else {
System.out.println("Not closing null input stream");
}
if (os != null) {
os.close();
} else {
System.out.println("Not closing null output stream");
}
System.out.println("Closing " + actualSocket.toString());
actualSocket.close();
}
mUpstreamSocketChannel.close();
mUpstreamSocketChannel = null;
}
} catch (Exception e) {
System.out.println("Exception " + e
+ " occurred while closing upstream socket channel");
e.printStackTrace();
}
try {
mUpstreamReadingSelector = null;
mPortsOpen = false;
} catch (Exception e) {
System.out.println("Exception " + e
+ " occurred while disconnecting from OTCMR");
}
}
None of the exception paths are hit (i.e., the only messages printed from the above are "Disconnecting" and "Closing <socket>".
Submitted On 01-APR-2007
Sheni_
Can some one confirm whether this is fixed in 1.4.2?
Submitted On 13-APR-2007
Hi,
this bug is definitively not complety fixed. If the remote server crashes the connection on the local machine is not cleaned up properly.
Or machine is running linux with JDK 1.5.0_10-b03.
Christian
Submitted On 11-JUL-2007
fog49
Still existing in the version below. Open ports don't get closed until GC.
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)
Submitted On 30-AUG-2007
Hi,
We are seeing the same kind of response with our implementation, CLOSE_WAITS after client calls the ESB. Does anyone know is it a JDK issue or Linux, please respond to my email ID: garyhassan@gmail.com
Submitted On 17-JAN-2008
Hi,
I have a small Java program using non-blocking ChannelSocket and it leaks File descriptors (Sockets never closed) as described in bug 6215050
I have tested on the following:
Linux RHEL 4 2.6.9-5.EL Sun JDK 1.5.0_11
Linux RHEL 4 Sun JDK 1.6.0_04
Linux RHEL 4 Bea JRockit 1.6.0_02
Ubuntu Linux 7.10 server 2.6.22-14 Bea JRockit 1.6.0_02
all with the same result.
I have tested a great number of suggested work arounds without success.
The socketChannel.socket().setKeepAlive(true); seems to make the number of "pipe" file descriptors less, but the problem remains and eventually the process stops.
Is this a Linux problem or Java problem?
/Roland
Submitted On 25-MAR-2008
HareeshPotty
I am facing the same problem while using rox XML-RPC client. I am using this xml-rpc client for connecting to a xml-rpc server for every 5 seconds. After 10 mins I am getting the following exception in my log file.
java.io.IOException: Too many open files
at sun.nio.ch.DevPollArrayWrapper.init(Native Method)
at sun.nio.ch.DevPollArrayWrapper.<init>(DevPollArrayWrapper.java:69)
at sun.nio.ch.DevPollSelectorImpl.<init>(DevPollSelectorImpl.java:54)
at sun.nio.ch.DevPollSelectorProvider.openSelector(DevPollSelectorProvider.java:18)
at com.flat502.rox.processing.ChannelSelector.<init>(ChannelSelector.java:34)
at com.flat502.rox.processing.ResourcePool.newChannelSelector(ResourcePool.java:166)
at com.flat502.rox.processing.ResourcePool.getChannelSelector(ResourcePool.java:32)
at com.flat502.rox.processing.HttpRpcProcessor.initialize(HttpRpcProcessor.java:471)
at com.flat502.rox.client.HttpRpcClient.initialize(HttpRpcClient.java:735)
at com.flat502.rox.client.HttpRpcClient.<init>(HttpRpcClient.java:117)
at com.flat502.rox.client.XmlRpcClient.<init>(XmlRpcClient.java:66)
at com.flat502.rox.client.XmlRpcClient.<init>(XmlRpcClient.java:62)
at com.smsaggregator.RequestManager.recieveSMSRequests(RequestManager.java:140)
at com.smsaggregator.RequestManager.run(RequestManager.java:262)
at java.lang.Thread.run(Thread.java:595)
I am using the following env for development.
SunOS SCKN567H 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-4
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)
Submitted On 16-SEP-2008
christopheLemoine
Number of open pipes growing when using nio SocketChannel (memcached JAVA client implementation).
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode)
Linux: 2.6.9-11.ELsmp #1 SMP Fri May 20 18:25:30 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux
Submitted On 18-SEP-2008
christopheLemoine
Tested with 1.5.0_16: Same results.
Tried to call
sChannel.socket().shutdownInput();
sChannel.socket().shutdownOutput();
before sChannel.socket().close();
Still not working.
It is really a critical bug: we are using memcached API based on a connection pool. The number of open file is growing very quickly (pipes not closed).
I really do not understand why it is not fixed or why a proper work around is not available.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|