Why does my VBJ application crash the Java VM on my dual processor machine?

From Support
Jump to: navigation, search

Question:

Why does my VBJ application crash the Java VM on my dual processor machine?

An application written in C++ uses JNI to start Java threads that make VisiBroker (obj_is_ready) calls.  On a dual processor Windows NT machine the application crashes with an access violation. The same application does not crash on a single processor machine.

Answer:

The Windows NT Java VM has a problem running on multiple processors - Java
Bug ID 4066650 (and related 4049821) is the probable cause. This is
supposed to be fixed in the final JDK 1.2 release and is present in all 1.1 JDKs according to the information at http://developer.java.sun.com/developer/index.html in the Bug Parade database.

A workaround to this problem is to use the Windows SetProcessAffinityMask() function to limit the process affinity to one CPU. This can be done in the C++ executable before starting any Java threads through JNI.

Another less useful workaround is to manually set the Affinity to a single processor in the
Task Manager. A little tricky since the application must be running to do this.  HOwever this technique can be used to confirm the problem and whether using the SetProcessAffinityMask() function will resolve the problem as a more permanent workaround.
 



Article originally contributed by Borland Developer Support