-
Bug
-
Resolution: Fixed
-
P3
-
11, 13.0.2, 14, 15
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8246762 | 13.0.4 | Roger Riggs | P3 | Resolved | Fixed | b05 |
JDK-8257981 | 11.0.11-oracle | Sean Coffey | P3 | Resolved | Fixed | b01 |
JDK-8241697 | 11.0.8 | Roger Riggs | P3 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
Windows 10, JDK 13
A DESCRIPTION OF THE PROBLEM :
When starting processes using java.lang.ProcessBuilder / java.lang.Process, the Windows handle count increases continuously. This leads to the system becoming unresponsive after reaching several hundred thousand handles.
Java 8 and Java 9 are not affected, the regression seems to occur since Java 10.
REGRESSION : Last worked in version 8u241
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test program below. Observe the handle count in den Windows Task Manager by enabling the handle column in the details tab.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Windows handle count stays stable.
ACTUAL -
Windows handle count increases continuously.
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class HandleLeak {
public static void main(String[] args) {
while( true ) {
try {
Process testProcess = new ProcessBuilder("cmd", "/c", "dir").start();
Thread outputConsumer = new Thread(() -> consumeStream( testProcess.getInputStream() ) );
outputConsumer.setDaemon( true );
outputConsumer.start();
Thread errorConsumer = new Thread(() -> consumeStream( testProcess.getErrorStream() ) );
errorConsumer.setDaemon( true );
errorConsumer.start();
testProcess.waitFor();
System.gc();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
private static void consumeStream( InputStream inputStream ) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream));
while( reader.readLine() != null ) {
;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if( reader != null ) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
Windows 10, JDK 13
A DESCRIPTION OF THE PROBLEM :
When starting processes using java.lang.ProcessBuilder / java.lang.Process, the Windows handle count increases continuously. This leads to the system becoming unresponsive after reaching several hundred thousand handles.
Java 8 and Java 9 are not affected, the regression seems to occur since Java 10.
REGRESSION : Last worked in version 8u241
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test program below. Observe the handle count in den Windows Task Manager by enabling the handle column in the details tab.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Windows handle count stays stable.
ACTUAL -
Windows handle count increases continuously.
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class HandleLeak {
public static void main(String[] args) {
while( true ) {
try {
Process testProcess = new ProcessBuilder("cmd", "/c", "dir").start();
Thread outputConsumer = new Thread(() -> consumeStream( testProcess.getInputStream() ) );
outputConsumer.setDaemon( true );
outputConsumer.start();
Thread errorConsumer = new Thread(() -> consumeStream( testProcess.getErrorStream() ) );
errorConsumer.setDaemon( true );
errorConsumer.start();
testProcess.waitFor();
System.gc();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
private static void consumeStream( InputStream inputStream ) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream));
while( reader.readLine() != null ) {
;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if( reader != null ) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
- backported by
-
JDK-8241697 Windows handle Leak when starting processes using ProcessBuilder
- Resolved
-
JDK-8246762 Windows handle Leak when starting processes using ProcessBuilder
- Resolved
-
JDK-8257981 Windows handle Leak when starting processes using ProcessBuilder
- Resolved
- relates to
-
JDK-8240704 ProcessBuilder/checkHandles/CheckHandles.java failed "AssertionError: Handle use increased by more than 10 percent."
- Closed