JVM crashes when loading a native library - java

I'm working on a CD burner using java, where ( using JNI ) i must load some native libraries (DLL). Well, i know that to load a native library using "System.loadLibrary(libName)", the library must be set to one of the "java.library.path" paths, however if using "System.load(libPath)" there is no need for that.
So, i used to load all my native libraries using "System.load(libPath)" and that worked for all of them except a single one "BurnerCaller.dll" that causes a JVM crash with the error message below.
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (0xe0434352), pid=2280, tid=0x00000000000013a8
#
# JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [KERNELBASE.dll+0xaa7d]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Program Files\Java\MainWorkspace\NewAman\hs_err_pid2280.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
Here is the detailed result error.
The weird thing is that if and only if i put this library to the "bin" directory of the currently running JRE or JDK (that my application is using to run) it works like a charm.
Any help would be appreciated, thanks in advance.

Try other JDK (Oracle JDK, Open JDK, versions 6,7,8). make sure dll bitness (32 vs 64) match JDK bitness
Debug native code
It looks like pure native problem and you should use native tools.
If you have source code of BurnerCaller.dll you can attach(Visual Studio, WinDbg)\debug\fix it. At least you will see the stacktrace of native crash.
If you don't have the souce - just put it in java bin directory, the easiest way.
When system loader loads a library, it calls DllMain for this library, looks like the bug is somewhere around it.

Related

Java library only working on java 1.8

For a university assessment we're doing a large java project which makes use of a given external hardware that utilises a given java library to interact with it.
The main problem is that such java library only runs on java 1.8 (the reason is not clear yet) and just fails with newer versions of java.
Since the rest of the code (a few thousands) is written in java 9, it's obviously a hard task to rewrite everything without making uses of all the functionalities added since java 1.8
I have the following questions:
Is there a way to make the whole project back-compatible without changing thousands of lines of code? (or to make the library work with a newer version of java)
In the case there isn't such way, is there an easy way to see what needs to be changed to make the project compatible with a previous version of java?
Thank you in advance for any answer, any small contribution will be a great deal for us
Error stack trace:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180005b00, pid=20224, tid=10952
#
# JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.4+11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.4+11, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C [rxtxSerial.dll+0x5b00]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\works\Documents\GitHub\Software-Engineering\src\hs_err_pid20224.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

Java version 6 VM

I have a problem with the VM from Java.
I installed on my PC Ubuntu 12.04 and installed the following Java version: OpenJDK Java6 Runtime.
I also installed the programm DigiESP.
DigiESP is an ID for a DigiModul. DigiESP is based on Eclipse. Now my
problem when I want to start DigiESP I got a error message:
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb11c9074, pid=3216, tid=3075950272
#
# Java VM: Java HotSpot(TM) Client VM (11.0-b15 mixed mode, sharing linux-x86)
# Problematic frame:
# C [libxul.so+0x915074]
Normally I used a Windows PC, but now I need this program for a study project.
I don't know much about Ubuntu, so I could use help with this problem.
From the linked bug report, this may be caused by XULRunner version 2. As a workaround you may disable it, though I don't know which application components are using it.
-Dorg.eclipse.swt.browser.XULRunnerPath=/dev/null
This system property will disable XULRunner for you.

STS 3.7.0 crashes on start-up, Windows 7, 64 bit

I recently downloaded the zip file of spring tool suite(3.7.0) from it's official web page(https://spring.io/tools/sts/all). After unzipping it and double clicking the sts.exe file, it asks for the namespace. After that when sts loads, the dashboard appears but after few seconds the application crashes. I'm getting the following error popup..
And also a log file is generated whose first few lines are..
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ILLEGAL_INSTRUCTION (0xc000001d) at pc=0x000007fee5f4ca90, pid=5020, tid=3860
#
# JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [msvcr120.dll+0x8ca90]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
I can't seem to understand where I am going wrong. I installed both 32, 64 bit JDK on my machine just in case but still nothing. Is it because windows did not install properly on my laptop?? Please help..
EDIT 1:
In response to #Pendlimarri's comment below, the different forms of Java installed in my control panel are..
I too got the same problem. I fixed by uninstalling the 1.8.0_60 update from Control Panel.
This might be a bug in 1.8.0_60.
FWIW, it's probably because STS is 32-bit and your JDK is 64-bit - change one or the other and it should work

IcedTea and lwgjl

I have recently found myself on a Linux computer and am liking it so far.
However, I have been having an issue and dont really know the source. I am trying to make a java project that uses lwjgl in eclipse (something I have done in windows) but when I run the code my display window comes up black and blinking and I get this error report-
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f5004c70c98, pid=10427, tid=139981673781008
#
# JRE version: 6.0_18-b18
# Java VM: OpenJDK 64-Bit Server VM (16.0-b13 mixed mode linux-amd64 )
# Derivative: IcedTea6 1.8.1
# Distribution: Ubuntu 10.04 LTS, package 6b18-1.8.1-0ubuntu1
# Problematic frame:
# C [libX11.so.6+0x37c98] XQueryExtension+0x28
#
# An error report file with more information is saved as:
# /home/jeff/workspace/SpinDodge3/hs_err_pid10427.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
#
I have the sun java 6 jdk installed and I have tried pointing eclipse to that using the -vm command but this error is the same. Java projects not using lwjgl work. Is this because I am using lwjgl wrong, the way it interacts with icedTea (something which the -vm command seems to do nothing for), eclipse? I have no idea where to even start.
Has anybody here used lwgjl in Linux, do they have any ideas?
Thankyou
(also I can post the error log but it is pretty long, I dont know how much help it will be)
EDIT: After I changed the jdk in use it runs but only for one frame and then crashes with this error-
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fbfd4fb7c98, pid=2060, tid=140461906126608
#
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) 64-Bit Server VM (16.3-b01 mixed mode linux-amd64 )
# Problematic frame:
# C [libX11.so.6+0x37c98] XQueryExtension+0x28
#
# An error report file with more information is saved as:
# /home/jeff/workspace/SpinDodge3/hs_err_pid2060.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Any ideas?
Run sudo update-java-alternatives -l to see the different versions of Java on your system. Then run sun update-java-alternatives -s [java type] to set it as the default, which binds it to the commands java, javaw, etc.
In your case, you should run sudo update-java-alternatives -s java-6-sun as mentioned on the Java Community Documentation page.
Well it looks like Java isn't the problem. You should read about SIGSEGV and XQueryExtension; it looks like your Xlib or X11 is to blame.
If I were you, at this time I would follow the instructions; go to https://bugs.launchpad.net/ubuntu/+source/openjdk-6/ and submit a bug report, paste this error and attach the logfile (/home/jeff/workspace/SpinDodge3/hs_err_pid10427.log). See if the experts can redirect you to exactly where the problem lies.
Also, of course, make sure your system is updated. You don't want to report a bug that has already been fixed.
As far as I can tell this is an error with eclipse and openGL in Ubuntu 10.04. It happens regardless of the jdk used (I have tried both). However, I have figured out that this error is only thrown when the program closes and was not causing the problems I saw with the lwjgl rendering. Except for the build-up of error logs just ignoring this error has caused me no problems so far.
You are not executing with the Sun JVM but with the OpenJDK, and there are subtle differences. Switch Ubuntu to use the Sun JVM and try again.

GWT 1.6.4 on FreeBSD?

Anyone have GWT 1.6.4 running on FreeBSD? Our build server is a FreeBSD box, and dies with the following when we try to compile:
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000800d0c724, pid=4749[thread 34370233088 also had an error], tid=0xa02d80
#
# Java VM: Diablo Java HotSpot(TM) 64-Bit Server VM (10.0-b23 mixed mode bsd-amd64)
# Problematic frame:
# V [libjvm.so+0x20c724]
#
# An error report file with more information is saved as:
# /usr/home/username/reporting/hs_err_pid4749.log
#
# Please submit bug reports to freebsd-java#FreeBSD.org
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
Interestingly, Maven seems to include gwt-dev-1.6.4-linux.jar in the classpath, presumably because there is no version for FreeBSD; I don't know if this is related or not. We are just trying to compile, not use hosted mode, so I don't believe any native libraries are actually required. This used to work fine for us with GWT 1.5.
If you search Google for that frame (libjvm.so+0x20c724) you find some relevant recent threads on the freebsd-java list.
Looks like the problem might be related to IPv6? The solution proposed there was to add
-Djava.net.preferIPv6Addresses=false
-Djava.net.preferIPv4Stack=true
to the configuration.
It's unusual to see a FreeBSD build system for java; there isn't a lot of flexibility or support for Java on that platform. Is your product deployed on FreeBSD as well? If the solution above doesn't work, you may have to get more closely engaged with the freebsd-java community or else consider trying another platform for the build.
We seem to have dodged this by using JDK5 to compile our GWT-based code. Not a perfect solution, but a work-around.

Categories