views:

547

answers:

7

I've written a Java app that allows users to script mouse/keyboard input (JMacro, link not important, only for the curious). I personally use the application to automate character actions in an online game overnight while I sleep. Unfortunately, I keep coming back to the computer in the morning to find it unresponsive. Upon further testing, I'm finding that my application causes the computer to become unresponsive after about 10 minutes of user idle time (even if the application itself it simulating user activity). I can't seem to pin-point the issue, so I'm hoping somebody else might have a suggestion of where to look or what might be causing the issue.

The relevant symptoms and characteristics:

  • Unresponsiveness occurs after user is idle for 10 minutes
  • User can still move the mouse pointer around the screen
  • Everything but the mouse appears frozen... mouse clicks have no effect and no applications update their displays, including the Windows 7 desktop
  • I left the task manager up along the with the app overnight so I could see the last task manager image before the screen freezes... the Java app is at normal CPU/Memory usage and total CPU usage is only ~1%
  • After moving the mouse (in other words, the user comes back from being idle), the screen image starts updating again within 30 minutes (this is very hit and miss... sometimes 10 minutes, sometimes no results after two hours)
  • User can CTRL-ALT-DEL to get to Windows 7's CTRL-ALT-DEL screen (after a 30 second pause). User is still able to move mouse pointer, but clicking any of the button options causes the screen to appear to freeze again
  • On some very rare occasions, the system never freezes, and I come back to it in the morning with full responsiveness
  • The Java app automatically stops input scripting in the middle of the night, so Windows 7 detects "real" idleness and turns the monitors into Standby mode... which they successfully come out of upon manually moving the mouse in the morning when I wake up, even though the desktop display still appears frozen

Given the symptoms and characteristics of the issue, it's as if the Java app is causing the desktop display of the logged in user to stop updating, including any running applications.

Programming concepts and Java packages used:

  • Multi-threading
  • Standard out and err are rerouted to a javax.swing.JTextArea
  • The application uses a Swing GUI
  • awt.Robot (very heavily used)
  • awt.PointerInfo
  • awt.MouseInfo

System Specs:

  • Windows 7 Professional
  • Java 1.6.0 u17

In conclusion, I should stress that I'm not looking for any specific solutions, as I'm not asking a very specific question. I'm just wondering if anybody has run into a similar problem when using the Java libraries that I'm using. I would also gladly appreciate any suggestions for things to try to attempt to further pinpoint what is causing my problem.

Thanks!

Ross

PS, I'll post an update/answer if I manage to stumble across anything else while I continue to debug this.

Update: my app involved multi-threaded processes each initializing their own Robot objects and creating input events asynchronously. I refactored the app to only contain one Robot singleton object, but the different processes still asynchronously invoke input commands. As far as I can tell, this did not change the behavior of my app. My next step might be to created a synchronized wrapper around the Robot singleton to see if that helps, but given the symptoms, I don't know why it would.

+3  A: 

I've had problems using the Robot class before. I forget exactly what I've done, but it has caused the computer to lock up and I've been forced to reboot.

camickr
Yah, I'm getting tired of the rebooting =\Perhaps I'll focus my search more on the Robot class. Thanks!
Ross
+4  A: 

I'm not familiar with the vagaries of Robot, but Uncaught exceptions in GUI applications can produce very odd results as the event dispatch thread dies and restarts. You might get some ideas from How uncaught exceptions are handled.

trashgod
+2  A: 

This can happen if u activated any screen saver or some thing like that, then this robot actions will stop working

i got this problem in the following way

i am having some GUI based applications and i written some test code based on Robot class.

but if i activated screen saver in my system this test cases stopped working...

please check any such scenarios are there in your case

sreejith
Did your code using Robot stop working, or did your entire system become unresponsive after you came out of screensaver mode?
Ross
the code in which i am using robot stopped working
sreejith
A: 

I have the same issue with swing based application, without using Robot at all. I've started Swing application on Windows 7, which works great on XP, and everything except mouse get freezed after few minutes. Any ideas?

Did you write the app (it's tough to tell from your comment)? If not, there's not a whole lot you can do other than submit the error to the author. One thing you can try is run the app while watching resource usage, and if CPU consumption shoots up to 100% before it freezes (or something similar), it's definitely a different issue than what I'm experiencing.
Ross
A: 

We have two machines with almost exactly same behavior with Java applications.

One is with Windows 7 64 bit, where Eclipse 64bit and Java 6 (64bit) is causing exactly same freeze.

Other is with Windows 7 32 bit and Java application utilizing a lot of CPU and disk activity causing freeze.

Both machines are notebooks from Toshiba with modern CPU's (Core 2 Duo).

Also both machines have NOD32 anti virus installed.

Standard apps (Office, Skype, Firefox,...)

Marko
Any idea if the Java apps they run are using the awt.Robot package? It would seem that the Robot usage is the key to the issue I'm having.
Ross
Not sure, 64bit machine blocks by using Eclipse IDE, even during checkout process. It seems to me that usually blocks during bit more intensive disk I/O, but this could be wrong.I am sure now that running Eclipse causes blocks. For example I worked 10 days without problems on machine, and as soon as I start Eclipse problem reappeared. Reboot, start Eclipse and again in less than 5 minutes.
Marko
A: 

I have the same problem, as soon as I open a few Java Application in Windows 7 Pro 64bit system freezes, sometimes works and sometimes fails, or sometimes a wait 20 minutes.... I tried different 1.6 jdk versions, now I am using jdk 1.6.0_20 but problem persist. I only use by the moment jdk 32 bits. I enabled trace java VM in Java Control Panel to log if some VM exception happended but i don´t know where that logs are written. I use NetBeans 6.8, one VirtualBox Machine, JEdit and a few more Java Apps.

The problem never exist in my old Windows XP 32 bits installation.

I have an Amd64x2 with 4GB.

I have original Windows 7 with the lastest updates.

This problem is very frustrating

Raúl
A: 

We seem to tracked down problem to NOD32. When we disable NOD32 it seems that beahaviour does not occure anymore.

I want to point out that I don't think it's NOD32 itself, but some combination of Windows 7, Java JDK and NOD32.

Marko
Interesting, I'm certainly not running NOD32, but I'm glad you found what was causing your issue :)
Ross