Community
Participate
Working Groups
When I run a simple program, which I have attached to this report, under the debugger I get the desired results printed to the console. About to schedule task. Task scheduled. Please Enter 'e' + <Enter> to end task Task begin text/html Task begin text/html Task begin text/html e Task ended ! When I run the same program but NOT under the debugger I get unexpected output: About to schedule task. Task scheduled. Please Enter 'e' + <Enter> to end task Task begin e Task ended ! I am running with Sun JVM 1.4.2 the 3.0 M7 build. I have tried running under Win2K and XP and get the same differing results. Can you explain to me why the results are different?
Created attachment 8336 [details] Testcase
I get the same results :-) What happens if you run from the command line (i.e. not Eclipse)?
When I run it at the command line it works (i.e. no eclipse). I get the following output About to schedule task. Task begin Task scheduled. Please Enter 'e' + <Enter> to end task text/html Task begin text/html Task begin text/html e Task ended !
So when you run in Eclipse, it hangs?
Yes, when I run it in Eclipse and NOT under the debugger it appears to hang. Under the debugger it works as expected.
Luc, please test this on WinXP?
Luc - have you been able to reproduce the problem?
I have seen a similar problem under 2.1.2 with my own code (not attached). The code runs correctly outside the debugger, but produces the wrong result in the debugger. It runs the same both in and out of the debugger in JBuilder 8.
Followup on my previous comment I have a case where the correct behavior (as defined by the command line execution of the JDK) is the same as the debugger, and normal execution within Eclipse is wrong. Setting JVM argument -Xint clears up this problem, but of course your program runs slower. Hope this clue helps.
I'm getting the same (unexpected) behavior now on XP, using IBM 1.4.2 and JDK1.4.2. Using -Xint does not make a different on JDK1.4.2.
Works for Kevin on XP/JDK1.4.2. Doesn't work for Darin on the same.
We don't know why, but we found that the call to write to System.out is blocking in RUN mode, but not in DEBUG mode. If we put a 1 second wait before reading from System.in, the problem does not occurr.
(I may have lied - it could be that #getContentType() is blocking).
Nothing planned for 3.0
I can not recreate this problem on Eclipse 3.0.1 and IBM JRE 1.4.2 SR1 (SOV or J9).
Darin, can you still cause this to happen?
The problem still occurrs for me.
From the comment above, it seems like this is should be a problem with the specific combination of VM, base libraries and OS configuration. It's odd that it works when run from the command line though. Do we understand exactly what is failing yet? Can you replicate this with more recent VMs? Also, is it possible to build a test case that exhibits the behavior but does not include running the app in Eclipse (e.g. does it fail if you fork the code to be run in a separate VM and pipe the output back to another one?). If we could find such a case, it would be worth reporting the problem to Sun.
This bug has been marked LATER. Are people still seeing this issue? If so, can we please make another stab at fixing it?
I still see the problem in 3.3 M4. However, looking at this again, I believe this is a duplicat of bug 40066. There are two workarounds mentioned in the assocaited Sun bug (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809647 ).If I change the main method to the following, the program works as expected when running: public static void main(String args[]) { System.out.println("About to schedule task."); new MyTimer(3); System.out.println("Task scheduled."); System.out.println("Please Enter 'e' + <Enter> to end task"); int c = 0; while (c != 101) { try { if (System.in.available() > 0) { c = System.in.read(); } } catch (IOException e) { // e e.printStackTrace(); } } System.out.println("Task ended !"); System.exit(0); }
*** This bug has been marked as a duplicate of bug 40066 ***