Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2045604 | 1.4.0 | Hui Huang | P3 | Closed | Fixed | beta2 |
The following test program creates 10 threads, each thread then executes
1000 times "/bin/ls". It can run successfully on Solaris but will
hang on Linux with JDK 1.3.1 or 1.4-beta.
-----------------------------------------------------------------------
public class ExecTest
{
public static void main(String[] argv)
{
for (int i = 1; i < 10; i++) {
final int ii = i;
new Thread() {
public void run()
{
ExecTest c = new ExecTest(ii);
}
}.start();
}
}
ExecTest(int i)
{
doExecs(i);
}
private void doExecs(int ii)
{
int i = 0;
while (true) {
try {
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("/bin/ls");
p.waitFor();
System.err.println("Thread " + ii + " created " +
++i + " processes so far");
if (i >= 1000) {
System.err.println("Thread " + ii + "finished.");
break;
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
}
}
}
}
------------------------------------------------------------------------
1000 times "/bin/ls". It can run successfully on Solaris but will
hang on Linux with JDK 1.3.1 or 1.4-beta.
-----------------------------------------------------------------------
public class ExecTest
{
public static void main(String[] argv)
{
for (int i = 1; i < 10; i++) {
final int ii = i;
new Thread() {
public void run()
{
ExecTest c = new ExecTest(ii);
}
}.start();
}
}
ExecTest(int i)
{
doExecs(i);
}
private void doExecs(int ii)
{
int i = 0;
while (true) {
try {
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("/bin/ls");
p.waitFor();
System.err.println("Thread " + ii + " created " +
++i + " processes so far");
if (i >= 1000) {
System.err.println("Thread " + ii + "finished.");
break;
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
}
}
}
}
------------------------------------------------------------------------
- backported by
-
JDK-2045604 LINUX: process reaping is broken
- Closed
- relates to
-
JDK-4366835 Linux: LinuxThreads bug in handling SIGCHLD
- Closed
-
JDK-4765001 b4482614 fails on Solaris 9
- Closed
-
JDK-4645451 Runtime.exec() crashes VM in concurrent threads
- Closed