Windows java crash log

how to set location of jvm crash log files

I need to configure where the jvm crash logs are created. I like the name they have (hs_err_pid.log) but I want them created in an specific folder.

In here you can see that you can use the

param to set the FILE created, but if you set this to a folder, so the file is created in that folder with the original naming convention, it does not work, it is ignored.

I have been testing this by crashing jvm 1.6 from this questions, using this: PathDasher dasher = new PathDasher(null) ;

Anybody knows a way to achieve this?

2 Answers 2

The parameter does not allow for environment variables, but you can use environment variables in a launcher script (e.g. .sh or .bat) and the OS will do the substitution. However, this will use the value of the environment variable at the time of starting the JVM and not when the file is written later. Furthermore, environment variables do not work when setting Run properties in Eclipse.

The JVM will not create intermediate directories saving the crash dump. The crash dump will be saved at the default location if the specified folder does not exist.

You have to use this as

java -XX:ErrorFile=/var/log/java/hs_err_pid%p.log -Xbootclasspath/p:. Crash

in command prompt. Here, Crash is my java file.

Not the answer you’re looking for? Browse other questions tagged java jvm crash-log or ask your own question.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Java Crashing Windows

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?

6 Answers 6

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
Читайте также:  Connect remotely to windows

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.

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).

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.

To crash the entire computer, try this:

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.

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

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.

Читайте также:  Samsung vg stc3000 windows

Java crashed application — how to find out why Java crashed?

My java server started to crash repeatedly, and I can’t find why.

I have server with 7.5GB memory and I have allocated 3GB for the java process.

Server was running fine, and ran garbage collection many times, but the JVM crashed when under memory pressure.

Here is the info from JConsole, after the crash:

I have 0.5 GB after a GC run, so all the time it raises from 0.5 to 3 GB and than fall back to 0.5, it is absolutely not problem with hanging objects. In fact it should throw OutOfMemoryException instead of crashing. I am using those parameters:

What is wrong and what shall I do? The output shown was:

4 Answers 4

From the crash doc you linked, the error is a SIGSEGV which is a fault reading/writing to native memory. The thread stack shows it crashed in JVM code.

Could be a JVM bug, or perhaps memory corruption.

If you with «a memory problem» mean that you are worried that your physical hardware is defective, you should strongly consider stress testing it.

For traditional PC’s the usual way to do this is with memtest86. The latest version appears to be available from here: http://www.memtest.org/

If the memory pass an all-night test with memtest86 you can be pretty certain it works correctly.

When you say you allocated 3 GB to the JVM, was this the heap size or the total size (which can be quite a bit bigger) e.g. a JVM with a 3 GB heap could use clsoe to 4 GB in total.

If the JVM has crashed on a GC, I would check you have a current version of the JVM, like Java 6 update 23.

What was the crash? Sometimes the same crash is reported by other people and you can google for it. Sometimes there is a suggested solution.

Sounds like a memory leak. The gc can only clean up objects that aren’t referenced anymore. And, if your application (or the server itself) doesn’t «free» unused ressources, after a while, even 3GB are not enough.

A Profiler might help to identify datastructures that grow unexpectedly.

Idea: start the server with -verbose:gc option and check what happens just before it dies. Decrease heap space for the test so that you don’t have to wait to long. If it’s a memory leak I expect that you see regular full gc cycle where the gc can free less memory each time it runs.

Update

I was mislead by the outofmemoryerror tag. In fact, it’s a JVM crash and all you can do is trying to update the installed Java. There are already some reports on «SIGSEGV (0xb)» crashes for builds 1.6.0_17 and 1.6.0_18 (like this question on SO).

Java crash on 32-bit Windows when launching Web Start application

At work we use a Personnel Administration System that uses Java Web Start. We use Java 8.40, Internet Explorer 11 and Windows 7. Mostly 64-bit Windows but some 32-bit. The computers with Windows 7 32-bit have trouble starting the application every morning. They have to try between 2 and 10 times before the application starts. Once they get in they can close the application and it will start without any problems. Chrome usually works a little better but there is a policy at work that IE should be used.

I have followed Oracles Java troubleshooting guides and other online resources without any luck.

  • checked Anti-Virus and Firewall configuration.
  • made sure that Java is activated in the browser
  • checked different configurations in Java Control Panel
  • removed temporary files in IE and Java Control Panel
  • I’ve made sure that we use 32-bit JRE
  • tested to run IE without add-ons
  • and a lot of other stuff
Читайте также:  Apktool 4pda для windows

This link is one of the more useful ones I’ve found on fine tuning Java.

When I choose to Show Console in Java Control Panel and enabled tracing and logging, this is what happens when the application doesn’t start:

  • the console appears and starts to log events
  • the console suddenly closes
  • Java loading image never appears
  • Java and Windows log files don’t show any errors.

Although Java seems to crash there are no error files (hs_err_pid*) to be found anywhere. I’ve searched the whole disk and even tried to set the JVM parameters to set a path for the error file (thanks Saeid)

I’ve also run Process Monitor during the start of the application with filters on jp2launcher process and the path of the Java cache folder but that didn’t give me any useful information.

I want to emphasize that the application eventually starts. The 32-bit users just have to try several times. The 64-bit users don’t seem to have any problems.

This is what Process monitor shows at the moment when the Java Console Window abruptly closes:

This is what the trace file look at the same moment:

and the log file:

Viewing crash dumps on Windows

Viewing Java Virtual Machine crash logs

If you are running Micro-Manager in the normal way (with the GUI), the Java Virtual Machine will save a crash log if the whole program crashes. Most of the time, such a crash means that something went wrong in one of the C++ components of Micro-Manager.

JVM crash log files are named hs_err_pid*.log, with the process id of the JVM that crashed, and are placed in the Micro-Manager folder.

Although the JVM normally can catch errors that cause the process to crash (such as access violations (= segmentation faults)), sometimes the memory corruption (or some other condition) resulting from the error is severe enough to cause the JVM’s crash handler to fail or not be executed. In that case, the only way to see what happened (save for running Micro-Manager with a debugger attached) is to have Windows produce crash dumps.

Note that, when the JVM saves a crash log, Micro-Manager’s windows will just disappear, with no error dialog box (as far as Windows is concerned, the program terminated of its own will). When the JVM crash handler fails, you will usually see Windows display a message saying «Java(TM) Platform SE binary has stopped working».

Generating Windows application crash dumps

Windows crash dumps are disabled by default (to be precise, saving them locally is disabled by default; there is a mechanism to allow sending the dumps to Microsoft, but that is not helpful for our purpose). To enable local saving of crash dumps on Windows Vista, 7, or later, download this file, extract the .reg file, and open it (administrator permission will be required), which will add the necessary settings to the Windows registry. (See Microsoft’s documentation for details on this.)

Following this setup, when java.exe or javaw.exe crashes, a crash dump should be saved at

where the location of %LocalAppData% can be checked by typing echo %LocalAppData% into the Command Prompt. The App Data directory is hidden by default; the easiest way to open the CrashDumps folder is to open a Command Prompt and type

Note that crash dump files can get quite large (especially if the application is using a lot of memory).

This file will disable the saving of all Windows application crash dumps.

If you are running Windows XP, the method described on this page should work.

Оцените статью