1

I have been developing a Java application using J2EE and a Derby database. My boss does most of the testing and I do most of the coding, but he has come to me with a strange problem. He claims that occasionally the Java application "crashes his computer".

To mention a few details, first let me say that I am currently working remotely, so I can't be around when these "crashes" happen. Second, I use OS X 10.6 and he uses Windows XP (SP3 I believe). The Java application in question does not use any JNI or anything weird except for an embedded Derby database. Lastly, he said it freezes everything in Windows (his mouse doesn't even move) -- it doesn't show up in the console like an uncaught exception would.

So, is it possible that my Java program is crashing his computer? I didn't think that Java code could have any system-wide effects outside of the JVM. Is this something that could possibly be the fault of my program, or should I just ignore it and attribute it to some problem with his computer?

2
  • J2EE is a fairly wide (and old) term. Did you mean to say a Java (JSP/Servlet) web application? If so, how was that tested? With a webbrowser? If so, which one? Was there also some Javascript involved? If so, I'd pay attention to that as well. Commented Jan 7, 2010 at 22:10
  • 1
    its J2EE only in the sense that i'm using javax.persistence, everything else is swing Commented Jan 8, 2010 at 0:23

6 Answers 6

3

For a Java application to crash the OS it runs on, there must be a bug in the JVM. That said there are situations that can give the same impression:

  • the Java application can grow its heap far enough that the OS starts to swap and other applications appear to slow down to a halt
  • the Java application can grab all CPU by one or more threads in a tight busy loop

If you can setup your testers' machine so that a heap dump can be triggered when the problem occurs, you can analyse that dump remotely. For instance with IBM's Java heap analyzer found on alphaworks.

Sign up to request clarification or add additional context in comments.

4 Comments

Or the operating system could be separately unstable in a way that Java simply pokes extra hard but otherwise is doing completely correct things.
Or the operating system could be completely stable, and @rsp's response is completely accurate.
I wasn't disagreeing with his options... just adding one. In my personal experience, every time Java has blue-screened a windows box it is because of a bad Windows install or hardware error. I've had Java blue-screen a box with bad RAM, I've had Java blue-screen a box with dodgy network drivers, bad graphics drivers, etc..
And note "his mouse doesn't even move"... is more than just a busy machine. If this happens, also check to see if the keyboard numlock light still toggles with the numlock key. If not then Windows is hard-locked.
2

There were cases before of crashes under windows on IBM Thinkpads (and other machines I am sure) due to a bad graphics driver. I'd suggest doing the usual thing of making sure the drivers are up to date just to be on the safe side.

While your code may not use JNI directly a lot of what happens under the hood can (anything that integrates with the underlying OS essentially). Which means drivers can be a big problem.

The other thing would to be sure that the most recent version of the Java is being used (if 1.6_17 isn't possible at last the latest version of the version of Java being used).

One other thing that has fixed random crashes for me is to re-seat the memory (unplug it and plug it back in).

2 Comments

its funny you mention thinkpads, thats what he's running. i think you may be right that it is a driver issue, but honestly, i'm just interested in knowing if my program could have done this (which sounds like no).
well not directly. The thinkpad issue was ultimately a directx issue where directx was being heavily used by Java where no other application heavily used it in that way, so it exposed an underlying bug in the driver.
2

he said it freezes everything in Windows (his mouse doesn't even move)

A user-mode application — whether Java or otherwise — can't do that against a modern OS like WinNT.

He either has a hardware problem, or a bad driver.

Comments

1

To crash the entire computer, try this:

public void crashComputer() {
    while(true)
        new Thread(new Runnable() {
            @Override
            public void run() {
                while(true) {
                    crashComputer();
                }
            }
        }).start();
}

public void crashJVM() {
    while(true)
        crashJVM();
}

The crashComputer function takes about 2 seconds to crash the entire computer. You can stop it from crashing by holding power button.

The crashJVM function crashed only the JVM by overloading the stack, causing a stack overflow (That's where the name of this website comes from).

WARNING: Use at your own risk. This will not damage your computer, but I'm not taking the blame if you forget to click save on a document or something.

Comments

0

Also check the page file space on the client (Windows/XP) system.

Comments

0

Point one: On my XP, SP3 system, when any program runs full tilt, it almost locks up the computer. When my anti-virus program checks for updates, everything else stops for all practical purposes, and it uses very little CPU (seems to be writing to disk all the time). My own infinite loops, using 100% CPU, have a similar effect. (Why the task manager does not get priority over a user program with "normal" priority I do not know.)

Point two: On any computer I've ever used, heavy paging will bring a program to an almost complete stop.

So start with an XP computer with 512Mb of real memory and 2000Mb of virtual memory. Write a Java program with 1400Mb worth of arrays and other data structures. Put in a loop that repeats several billion times and reads or writes to each byte in that 1400Mb on each execution. This program will not finish until long after the universe collapses in on itself. The computer will do nothing. I have not tried this and I do not intend to, but I will bet anything even the mouse won't move. Depending on the make of the computer, the only fix may be pulling the power plug out of the wall socket. (Note that technically, the computer has not crashed. Indeed, it is working just fine. But you are going to need to be patient. Move the mouse the day before you plan to click.)

The moral of this story is to avoid both XP and virtual memory, but if you have to deal with either, be aware of these problems.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.