FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
You'll need one PC with Windows XP connected on a network to a Sun server.
A DESCRIPTION OF THE PROBLEM :
What happens is if you rsh from the PC to the Sun and the command that's run takes more than 120 seconds then the command prompt should wait until the command completes and it does unless the command was run via Runtime.exec("rsh sun command") then if gets a Recv failed:Connedtion Reset by peer error.
This only happens when the rsh is run from within Java and it only happens on Windows XP (works fine on Windows 2000, however I believe it is a problem on Windows Server 2003 too).
Note the example test code below WaitTest is a simple program that just runs a command from withing Java using Runtime.exec, you may have your own command that does the same thing and I'm sure it will also reproduce the bug. I've tried rearranging things around with were reading the stdout and stderr go and that makes no difference.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
At the XP command prompt run
rsh sunserver sleep 125;hostname
wait two minutes and five seconds and the command comes back with the answer
java WaitTest rsh sunserver sleep 10; hostname
wait ten seconds and the command comes back with the answer
java WaitTest rsh sunserver sleep 125; hostname
waitn two minutes and you get an error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For the three cases above for a hostname of sunserver I expected
sunserver
sunserver
sunserver
ACTUAL -
sunserver
sunserver
Recv failed: Connection Reset by peer
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Recv failed:Connection Reset by peer.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
public class WaitTest {
public static void main(String[] args) throws Exception {
long t = System.currentTimeMillis();
StringBuffer sb = new StringBuffer();
for(int i=0;i<args.length;i++) {
sb.append(args[i]);
sb.append(' ');
}
System.out.println("Cmd " + sb.toString());
Process p = Runtime.getRuntime().exec(sb.toString());
p.getOutputStream().close();
InputStream out = p.getInputStream();
InputStream err = p.getErrorStream();
int c;
try {
while ((c = out.read()) != -1) {
System.out.print((char)c);
}
} catch(Exception e) {
System.err.println("Error reading stdout");
}
System.out.println("");
try {
while((c = err.read()) != -1) {
System.out.print((char)c);
}
} catch(Exception e) {
System.err.println("Error reading stderr");
}
System.out.println("");
p.waitFor();
System.out.println("End " + (System.currentTimeMillis() - t) + " " + p.exitValue());
}
}
---------- END SOURCE ----------
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
You'll need one PC with Windows XP connected on a network to a Sun server.
A DESCRIPTION OF THE PROBLEM :
What happens is if you rsh from the PC to the Sun and the command that's run takes more than 120 seconds then the command prompt should wait until the command completes and it does unless the command was run via Runtime.exec("rsh sun command") then if gets a Recv failed:Connedtion Reset by peer error.
This only happens when the rsh is run from within Java and it only happens on Windows XP (works fine on Windows 2000, however I believe it is a problem on Windows Server 2003 too).
Note the example test code below WaitTest is a simple program that just runs a command from withing Java using Runtime.exec, you may have your own command that does the same thing and I'm sure it will also reproduce the bug. I've tried rearranging things around with were reading the stdout and stderr go and that makes no difference.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
At the XP command prompt run
rsh sunserver sleep 125;hostname
wait two minutes and five seconds and the command comes back with the answer
java WaitTest rsh sunserver sleep 10; hostname
wait ten seconds and the command comes back with the answer
java WaitTest rsh sunserver sleep 125; hostname
waitn two minutes and you get an error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For the three cases above for a hostname of sunserver I expected
sunserver
sunserver
sunserver
ACTUAL -
sunserver
sunserver
Recv failed: Connection Reset by peer
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Recv failed:Connection Reset by peer.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
public class WaitTest {
public static void main(String[] args) throws Exception {
long t = System.currentTimeMillis();
StringBuffer sb = new StringBuffer();
for(int i=0;i<args.length;i++) {
sb.append(args[i]);
sb.append(' ');
}
System.out.println("Cmd " + sb.toString());
Process p = Runtime.getRuntime().exec(sb.toString());
p.getOutputStream().close();
InputStream out = p.getInputStream();
InputStream err = p.getErrorStream();
int c;
try {
while ((c = out.read()) != -1) {
System.out.print((char)c);
}
} catch(Exception e) {
System.err.println("Error reading stdout");
}
System.out.println("");
try {
while((c = err.read()) != -1) {
System.out.print((char)c);
}
} catch(Exception e) {
System.err.println("Error reading stderr");
}
System.out.println("");
p.waitFor();
System.out.println("End " + (System.currentTimeMillis() - t) + " " + p.exitValue());
}
}
---------- END SOURCE ----------