United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7118373 : (se) Potential leak file descriptor when deregistrating at around the same time as an async close

Details
Type:
Bug
Submit Date:
2011-12-06
Status:
Closed
Updated Date:
2013-09-12
Project Name:
JDK
Resolved Date:
2012-06-18
Component:
core-libs
OS:
linux_redhat_5.0
Sub-Component:
java.nio
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0u31
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
A CU found domain socket leak occurs in JDK5u28/6u30/7.

CONFIGURATION:
JDK : jdk7GA, jdk6u30, jdk5u31

% java -version
java version "1.5.0_31"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_31-b02)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_31-b02, mixed mode)

%java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

 % java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

OS : 
Linux
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Linux XXXXXX 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux


REPRODUCE:
1. Compile the attached e.java and execute "java e"
2. Invoke "lsof -U -a -p [PID]"
 If you can see several UNIX domain Sockets are created, that shows the problem is reproduced.

ex.
% lsof -U -a -p 3855
COMMAND  PID  USER   FD   TYPE             DEVICE SIZE     NODE NAME
java    3855 tbaba    4u  unix 0xffff810010ccf940      61967223 socket
java    3855 tbaba   17u  unix 0xffff810010cce600      61967239 socket

FREQUENCY:
It depends on enviromnment. In some machine, it will take 5 - 10 minutes  to reproduce this, in some machines, it needs several hours to reproduce.

                                    

Comments
EVALUATION

This bug can be reproduced by using jdk5u31 to run e.java on linux-x68 machine jsn-gtwy-1.us for 15 mins. Verify it is fixed in jdk8-b37 by running same test on same machine.
                                     
2012-06-18
EVALUATION

This has been diagnosed as a race between the deregistration and close. The preClose is missing a check for the ST_KILLED state.
                                     
2012-04-16
EVALUATION

Each Selector instance on Linux has socketpair that is used by the wakeup mechanism. There is also a socketpair used for the asynchronous close mechanism. So it is normal for lsof to report a java process using Unix domain sockets, in the test case then seeing 2 sockets is normal. We ran the test for >1h on RHEL5 and did not observe any more than 2 sockets.
                                     
2011-12-06



Hardware and Software, Engineered to Work Together