Can JNI overwhelm the JVM?
Can JNI overwhelm a busy JVM?
I have a program that uses a JNI callback to transfer data to my java application. I have been trying to resolve an internal virtual machine crash (listed below), and have been doing extensive testing on my program. I found that there were references to this same ID in several bug reports, but I did not find an applicable solution for my problem.
I am fairly confident that JNI is causing my ailment, and I have made several observations. First I wrote a call back using the "setByteArrayRegion" method and then the "NewDirectByteBuffer" method to pass my data. In both cases the function call seems to succeed and I have been able to verify the integrity of my data. I am fairly confident that this part is working. I did another test and found that if I make my native thread sleep between calls to slow down the rate at which JNI calls are made, my java application does not seem to get this random error.
Has anyone ever heard of a case where large numbers of JNI calls can overwhelm and pummel the JVM? I notice that when my java application is particularly busy doing I/O or other intensive processing, while large numbers of JNI calls are being made from my native thread, the error shows up more frequently. This is just a guess but I wanted to know if this was a possibility. Any other advice is welcomed and gladly accepted!
# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)
# Error ID: 43113F32554E54494D45110E435050034A
# Problematic Thread: prio=1 tid=0x0x8051968 nid=0x4c53 runnable
Can you upgrade to 1.4.1_02?
Have you run with -verbose:jni -Xcheck:jni ?
Make sure that you are not caching local references for use across calls into your jni code or across threads. Make sure that you are not trying to use JNIEnv* pointers across threads. The results of FindClass are local references, if you want to use them across jni calls you must get a global reference...
Use a debugger.
Check for exceptions and errors from each and every JNI call.
Similar Messages
-
Can I change the JVM running in JServer
I have set up a 8.1.5 database with the jserver option.
I have tried to load some java stored procedures into this database. Some of these fail because of unresolved errors for things like an iterator.
I can see why the resolution error is happening. That is my code uses jdk1.2 features, wheres as the jserver seems to be running the 1.1 java.
My question is: is there a way to change the jdk version being run by jserver? or is this version fixed by oracle?
I have used oracle 8.1.6 and this seems to work fine i.e. jserver runs java 1.2 libraries and everything loads and runs fine.Nope, you can't change the JVM. It's part of the Oracle kernel itself (like PL/SQL)
null -
Can you alter the JVM heap space size for all Windows users?
Hi,
I have used the "-Xmx" option to increase the Java Heap space for my Java application. This works fine, but all other users on my system still have the default heap space setting and I want them to have use an increased heap space as well. I cannot alter the JVM heap space at the command line since our Java application is started via an ActiveX bridge from a Windows application.
So far I have found one potential, but not really good solution; I have figured out that I can copy the deployment.properties file containing the altered JVM heap setting from the "Application Data\Sun\Java\Deployment" folder in my own Windows "Documents and Settings" folder to the same folder of another user. However, this is not a really good solution since we are running a system with about 60 users and often new user accounts are created and sometimes people forget to copy the deployment.properties file.
Does anyone know a better solution. I've tried to search the Windows registry or the JRE files for a default JVM heap space setting but I can't find it anywhere. Still on some systems the default is 64Mb and on others 96Mb, so I guess there must be a setting somewhere?The following is my eclipse.ini:
-vmargs
-Xms256m
-Xmx512m
-Dfuego.fstudio=true
-DprodMode=preProduction
-Dbea.home=C:\bea\albpm6.0\studio\..
-Djava.endorsed.dirs=""
-XX:PermSize=256M
-XX:MaxNewSize=256M
-XX:MaxPermSize=1024M
but i think this configuration just effect the eclipse, not embed bpm engine. I also change the engine preference, increase the heap size, but engine crash as before.
I want to change the jvm from jdk to jrockit, i hope any suggest. -
How can I get the jvm or kvm resource?
I am interested in the jvm,kvm.But I don't know very clearly the archicheture of the kvm or jvm. Where can I get the resource of kvm or jvm? Can I get a source code sample of kvm?
Do you mean source code?
The source code for the Sun jdk 1.3.1 is here...
http://java.sun.com/j2ee/download.html -
I can't create the JVM using JNI_CreateJavaVM
I'm very much new to the JNI on Windows 2000. When I compiled the example invoke.c program that invoke the java program, it generated invoke.exe file. but when I run the this executable file, it always shows "Can't create Java VM". I tried other samples, but the result is same. I am also sure that I copy jvm.dll from jdk1.2.2\jre\bin\classic to the same folder with invoke.exe file.
I use JDK1.2.2 and Microsoft Visual Studio 6.0 C++. Please let me know what's going on about the following program?
#include <jni.h>
#define USER_CLASSPATH "." /* where Prog.class is */
int main() {
JNIEnv *env;
JavaVM *jvm;
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jclass stringClass;
jobjectArray args;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString =
"-Djava.class.path=" USER_CLASSPATH;
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM\n");
exit(1);
cls = (*env)->FindClass(env, "Prog");
if (cls == 0) {
goto destroy;
mid = (*env)->GetStaticMethodID(env, cls, "main",
"([Ljava/lang/String;)V");
if (mid == 0) {
goto destroy;
jstr = (*env)->NewStringUTF(env, " from C!");
if (jstr == 0) {
goto destroy;
stringClass = (*env)->FindClass(env, "java/lang/String");
args = (*env)->NewObjectArray(env, 1, stringClass, jstr);
if (args == 0) {
goto destroy;
(*env)->CallStaticVoidMethod(env, cls, mid, args);
destroy:
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
(*jvm)->DestroyJavaVM(jvm);
return 0;Are you sure you are using the correct jvm.dll?
Remove any jvm.dll files you copied to your .exe directory and set your Path so that is using the jdk1.3 hotspot jvm.dll.
You said you were using windows so the default location of your jdk is C:\jdk1.3.1 To set your path to the correct location use this command:
set Path=%Path%;C:\jdk1.3.1\jre\bin\hotspot
If your jdk is installed somewhere else replace C:\jdk1.3.1 with the root path to your jdk.
If that doesn't work there may be a conflict with the way you compiled the program. -
Hi All
is there any other way of doing jvm size instead of java -jmxwhat is the problem you are having?
why do you care where it gets set?
if you're asking if you can up the size from within the program, the answer would probably be no, never seen that done anyway -
Change the default local value for the JVM
Hello,
Some applications check the JVM default language and set it.
my computer setting is German, i want to keep this.
And i want the java appliacations to start in english.
any idea how can i change the JVM default lacal value?
Thanks.I'm not sure if there's some global setting, take a look in the options that can be passed to "java" (executable).
Anyway, you could just use a
Locale germanLocale = Locale.GERMAN;
JavaDocs are your friend ;) -
Can I get the reference to all objects in JVM Heap?
Hello,
Thanx in advance for reading (and replying) to this problem.
I need to find an object whose reference I dont have.
I feel the best place to search for is the JVM heap.
If I get that JVM heap, and am able to get all the objects created, I can locate the particular object that I am looking for.
Is there a way to od this????
Any suggestions ????
VikasJVMTI will mostly help you in this case. But i recomend you to review you application design, because such services are unsafe and rather tricky.
-
Can I set the default locale for jvm
Hi,
Can I set the default locale for jvm?
How to do it?
PanMy windows default locale is chinese .I have thought of your opinion. But in
windows nt , if I change the locale , all the environment will be
destroyed(just like reinstall it , it's difficult for me) . So , Is there
any other approach?
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Did you try to change the locale in the Windows control panel?
(Control panel -> Regional Options -> Your locale)
Pan YangBin <[email protected]> wrote:
I have tried changing this system property and other properties such
as -Duser.language=en -Dfile.encoding=Cp1252 , but all these properties
did
not changed, you can get this infomation from the log file .Maybe these
system properties are readonly.
Thanks very much.
Pan
Chris Halstead <[email protected]> wrote in message
news:[email protected]...
Try adding -Duser.region=US to the java command line used to start
WebLogic...
-chris
"Pan YangBin" <[email protected]> wrote in message
news:[email protected]...
Hi,
The problem exists in my project still exist.That is it.
When I did not set weblogic.jsp.encoding to GB2312 in my web
application(web.xml), and when the jsp file contain's chinese , the
output
will be error(error chinese) .And when I did not set it , the output
is
correct, but when I use request.getParameter("SomeFormElement")(theelement
inputed chinese), the return value is error(still chinese error).And
when
I
am in windows nt english version and do not set this property, all
these
two
problems dispear. And I try to compare the java files those were
generated
by weblogic from the jsp file , there is only two additional clause
in
the
java file. That's it:
((weblogic.servlet.jsp.JspWriterImpl)out).setEncoding("GB2312");
response.setHeader("Content-Type", "text/html; charset=GB2312");
(the web.xml has <context-param>
<param-name>weblogic.jsp.encoding</param-name>
<param-value>GB2312</param-value>
</context-param> to be set
So, I think maybe it works well if I change the default locale toenglish.
And unfortunately, your method is also failed.(I have to use weblogic
in
chinese environment)
Would you please help me to solve this problem?
Pan
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Try java ... -Duser.language=en ...
or mode con cp select=437 in the command prompt before running
weblogic.
Pan YangBin <[email protected]> wrote:
I'm using weblogic server 5.1 sp6 in chinese environment, and I
want
weblogic compile my jsp with en_us locale . So I can't use
Locale.setDefault(new Locale(...)) to set the default locale ,butI
really
want someway configure.
Pan
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Locale.setDefault(new Locale(...)) ?
Pan YangBin <[email protected]> wrote:
Hi,
Can I set the default locale for jvm?
How to do it?
PanDimitri
Dimitri
Dimitri -
How can I get the time in Microsecond with JNI ?
How can I get the time in Microsecond with JNI ?
JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceFrequency (JNIEnv *env, jobject obj) {
LARGE_INTEGER lFrequency;
::QueryPerformanceFrequency(&lFrequency);
return (jdouble)lFrequency.QuadPart;
JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceCounter (JNIEnv *env, jobject obj) {
LARGE_INTEGER lpCounter;
::QueryPerformanceCounter(&lpCounter);
return (jdouble)lpCounter.QuadPart; -
How can i reload font information while the jvm is running.
l.s.
how can i reload font information while the jvm is running.
I'm having the following problem...
A program is running.
A user installs a new font on the system (Xwindows in this case)
Java doesn't display the font when i ask :
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();Thus i think that java buffers its font information somewhere. Anyone knows how to refresh te buffer?
many thanksungalcrys, welcome to the forum. Please don't post in threads that are long dead and don't hijack another poster's thread. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
I'm locking this thread now.
db -
How can I reduce the size of the jvm?
I would like to decrease the size of a jvm; I've found a program that makes it, but you don't know how does it works (and you have to pay for it), I'm talking about VM Optimizer 2.0, from Invirtus.
Can anyone tell me how can I reduce the size of the jvm?
Thanks a lot.I assume you mean the size of a JVM instance in memory and not the size of the JRE which is on the disk.
I don't believe that there is any way at present for your Java code to change the amount of memory available to the JVM. This shouldn't matter too much, though. Firstly, you can control the size of the JVM from the command prompt with the -Xms and -Xmx options. Secondly, any remotely reasonable operating system is going to wait until the JVM has requested memory before allocating all of it. If you start a JVM with a 2Gb heap, it does not occupy 2Gb of physical memory straight away.
Finally, I did a Google on InVirtus VM Optimizer and must request some information. What does that software have to do with Java? It's designed to reduce the size of a virtual computer as created by a prorgam such as VMWare. It has nothing to do with the Java virtual machine. -
Eclipse can't find the path to JVM
I tried running Eclipse and got an error that said that it looked for Java in /usr/share/eclipse/jre/bin/java and couldn't find it, so it can't run.
I'm pretty sure both the JVM and JDK are installed, although running 'java' and 'javac' result in "bash: java/javac: command not found".
Thanks.Do you have the files /etc/profile.d/{jre,jdk}.sh? Do they get sourced when you log in? They should. They are the ones that set up the various paths required to run java. I'd also have a look at /etc/profile. It should contain this part, that sources all files in /etc/profile.d:
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -x $profile && . $profile
done
unset profile
fi -
Why MS JVM can not fine the classpath
I have a applet and it's working fine with Sun JRE,but when I use MS JVM I always get error like can not fine the classpath,I alreday have created jar for all the applet class file and I have defined codebase and code ,using applet tag. I want to use Java1.1.
I use NetBeans 3.6 compile the whole applet. and Can you tell me how to do?The applet probably includes code that is not supported by, or compatible with, the MS jvm. That error is a typical response to this cause.
Try using the compiler option "-target 1.1". If that doesn't work, you could download an old jvm from Sun's archive page and recompile with it.
If that doesn't work, then you have to rewrite the applet to use only code that can be run by the MS jvm.
Be aware that there are differences between MS and Sun jvm's, so it may have to be rewritten no matter what. -
this post shows you can unload a class from the JVM... do you agree?
http://forum.java.sun.com/thread.jsp?forum=4&thread=327315&tstart=0&trange=15If you say "effectively", I would agree. Once the old classloader, the old class, and all old class instances are no longer reachable, then for all intents and purposes (except memory consumption) it is unloaded.
Of course, it's up to the JVM implemention to decide whether (if at all) and when to gc that stuff.
Maybe you are looking for
-
Remove adjustment from multiple images?
I have multiple images where I used Sharpen instead of Edge Sharpen. I know I can Lift & Stamp the Edge Sharpen adjustment to multiple images but I can't seem to find a way to remove the Sharpen adjustment from all of them first. Is there a way to ac
-
Please help me. My YouTube app will not work. Every time I open it says 'cannot connect to youtube'. I have searched for help and tried resetting my settings and rebooting my ipad2 but nothing has solved the issue.
-
Upgrade problems - files missing in site after the upgrade
gurus, i upgraded the webdb 2.2 to portal 3.0. when i went to the portal site, i found that in one folder some of the documents were missing. what i mean by the missing is, the document title was present in the folder but not as a link. it was there
-
Macbook not working with iPhone 4G
My iPhone 4G has been enabled. Still my Mac book does not recognize the iPhone 4G to connect to internet. Tell me how to enable this?
-
Photoshop CS6 - save as EPS - no JPEG Preview?
Hi! I was just trying to save a 8-Bit CMYK file as Photoshop EPS - I can only choose TIFF as preview format. How's that? Best Regards, Eric