Fixing: “An unexpected error has been detected by HotSpot Virtual Machine”

I had been consistently facing the standard “An unexpected error has been detected by HotSpot Virtual Machine”. I spent some time trying to figure out the root cause of the problem. I was not able to make any headway for some days.

Yesterday google search provided me with the answer. Added the following JVM option

-Djava.net.preferIPv4Stack=true

And presto the JVM crashes ceased. The above mentioned thread mentions that the Inet4AddressImpl is not thread-safe. If you thought the Sun guys were GODS, you must be mistaken. They are just mere mortals like us.

Advertisements

11 thoughts on “Fixing: “An unexpected error has been detected by HotSpot Virtual Machine”

  1. # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    # SIGSEGV (0xb) at pc=0xaa6dff1d, pid=8021, tid=3073497856
    #
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_18-b06 mixed mode)
    # Problematic frame:
    # C [libawt.so+0x225f1d] _XmAddHashEntry+0x15

  2. Holla

    After I have ran this command I get this error.

    root@lenovo-desktop:/opt/sakai-release/sakai-src-2.5.3# mvn clean install sakai:deploy
    [INFO] Scanning for projects…
    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    # SIGSEGV (0xb) at pc=0xb782dea6, pid=7005, tid=2990836624
    #
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing)
    # Problematic frame:
    # V [libjvm.so+0x159ea6]
    #
    # An error report file with more information is saved as hs_err_pid7005.log
    #
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    #
    Aborted

    How can I fix this I have tried -Djava.net.preferIPv4Stack=true but it seem not to work.

  3. I just had that problem while trying to play a game just installed. It crashed and gave me a log file with that error in it. Question is, how do u add the following option? Im a noob so i hope u could guide me thru step by step. Thanks.

    1. Typically you would have some kind of .bat file to start your game. Check if it has some command starting with java. If yes, add the JVM option as I mentioned in my post. The command will become

      java ………………… (something here) -Djava.net.preferIPv4Stack=true

  4. its really help ful ; i got the same issue but i add the same JVM option ; it works really fine…Thanks alot dude…looking more replies if we got stuck with any of the issues…

    1. If you are using command line it will be of the following format:

      java -Djava.net.preferIPv4Stack=true

      If you are using an IDE or application server, check its documentation about how to add a JVM option/argument.

  5. i added the following
    java -Djava.net.preferIPv4Stack=true -jar Test.jar

    but still i am getting the error. What could be the problem. JRE version is 1.5.0_08

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s