Solved

JVM crash on XML parsing

Posted on 2004-08-20
14
703 Views
Last Modified: 2008-03-06
Hello Experts,

I'm in real trouble. The JVM is crashing in a XML parsing after app had loaded two dll JNI wrappers. It just happen when both wrapper classes  are loaded what makes me believe in some memory invasion in the dll. But it works fine in test mode. Im test mode I load both wrappers and call it methods. The weird point is that one wrapper encapsulates XFS that uses a vendor api, and the other one want to use the vendor API directly.

I tryed to upgrade from 1.4.2_03 to 1.4.2_05 but the problem persist. I tryed almost all that I can figure out. Some idea?

=============================================================================================
StateMachine::init - begin
StateMachine::initDevices - begin
ObDev::Constructor::Device ID [7] -> class com.hp.oba.obdev.ObWosaXFS
ObDev::Connect::Device ID [7]
ObDev::SetErrorCode::Device ID [7] -> 0
ObDev::Connect::Device ID[7] succeed
ObDev::Constructor::Device ID [6] -> class com.hp.oba.obdev.ObWosaXFS
ObDev::Connect::Device ID [6]
ObDev::SetErrorCode::Device ID [6] -> 0
ObDev::Connect::Device ID[6] succeed
ObDev::GetCaps::Device ID [6]
ObDev::Constructor::Device ID [8] -> class com.hp.oba.obdev.ObPertoAPI
ObDev::Connect::Device ID [8]
[<?xml version="1.0" encoding="UTF-8"?><java version="1.0" class="java.beans.XMLDecoder"><object class="com.hp.oba.obdev.ObDevResult"><void property="errorCode"><int>0</int></void></object></java>]
ObDev::SetErrorCode::Device ID [8] -> 0
ObDev::Connect::Device ID[8] succeed
StateMachine::initDevices - end
StateMachine::initTransactions - begin
ScreenFlowManager() - begin
ScreenFlowManager() - end
RequestProcessor() - begin
RequestProcessor() - end
DeviceManager() - begin
DeviceManager() - end
TemplateService() - begin
TemplateService::initScreens - begin
Screens::loadScreenDefinitions - begin
ScreenDefinition::loadDocument - begin
1. ScreenDefinitions.xml
2.
3.
4.
5.

Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4D212
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:

Dynamic libraries:
0x00400000 - 0x0040B000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\javaw.exe
0x78460000 - 0x784E1000       C:\WINNT\system32\ntdll.dll
0x792D0000 - 0x79332000       C:\WINNT\system32\ADVAPI32.dll
0x79720000 - 0x797DF000       C:\WINNT\system32\KERNEL32.DLL
0x77120000 - 0x77191000       C:\WINNT\system32\RPCRT4.DLL
0x77E10000 - 0x77E75000       C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7E000       C:\WINNT\system32\GDI32.DLL
0x78000000 - 0x78045000       C:\WINNT\system32\MSVCRT.dll
0x08000000 - 0x08139000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\client\jvm.dll
0x77550000 - 0x77581000       C:\WINNT\system32\WINMM.dll
0x10000000 - 0x10007000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\hpi.dll
0x007E0000 - 0x007EE000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\verify.dll
0x007F0000 - 0x00809000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\java.dll
0x00810000 - 0x0081D000       C:\Arquivos de programas\Java\j2re1.4.2_05\bin\zip.dll
0x18270000 - 0x182B4000       C:\WINNT\ObWosaXFS.dll
0x182C0000 - 0x182E6000       C:\WINNT\system32\MSXFS.dll
0x18300000 - 0x18320000       C:\WINNT\system32\XFS_SUPP.DLL
0x18330000 - 0x1833B000       C:\WINNT\system32\XFS_CONF.DLL
0x6E390000 - 0x6E396000       C:\WINNT\system32\INDICDLL.dll
0x75E30000 - 0x75E4A000       C:\WINNT\system32\IMM32.dll
0x184B0000 - 0x184D6000       C:\WINNT\system32\PERTOSP.DLL
0x184E0000 - 0x18501000       C:\WINNT\system32\pertoapi.dll
0x18D60000 - 0x18D90000       C:\WINNT\system32\PTPINTACF.DLL
0x779B0000 - 0x77A4B000       C:\WINNT\system32\OLEAUT32.DLL
0x77A50000 - 0x77B47000       C:\WINNT\system32\ole32.dll
0x19340000 - 0x19374000       C:\WINNT\system32\PT623UB.DLL
0x196E0000 - 0x196F5000       C:\CEF\ClientJava\src\dev\ObPertoAPI\ObPertoAPI.dll
0x19B00000 - 0x19B30000       C:\WINNT\system32\PTSIUTACF.DLL
0x77920000 - 0x77943000       C:\WINNT\system32\imagehlp.dll
0x729B0000 - 0x729DD000       C:\WINNT\system32\DBGHELP.dll
0x68F90000 - 0x68F9B000       C:\WINNT\system32\PSAPI.DLL

Heap at VM Abort:
Heap
 def new generation   total 576K, used 251K [0x10010000, 0x100b0000, 0x104f0000)
  eden

****************
Another exception has been detected while we were handling last error.
Dumping information about last error:
ERROR REPORT FILE = (N/A)
PC                = 0x00a4d212
SIGNAL            = -1073741678
FUNCTION NAME     = (N/A)
OFFSET            = 0xFFFFFFFF
LIBRARY NAME      = (N/A)
Please check ERROR REPORT FILE for further information, if there is any.
Good bye.

==============================================================================================================



    public static Element loadDocument(String filename) {
          System.out.println("ScreenDefinition::loadDocument - begin");
        try
        {
              System.out.println("1. " + filename );
            FileInputStream file = new FileInputStream(filename);
              System.out.println("2.");
            InputSource xmlInp = new InputSource(new BufferedInputStream(file));
              System.out.println("3.");
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
              System.out.println("4.");
            DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
              System.out.println("5.");
            Document doc = parser.parse(xmlInp);

==================================================================================================================

package      dev;


public class VendorAPIWrapperA implements IObWosaXFS {
   
      static VendorAPIWrapperA self = null;
      
    private VendorAPIWrapperA () {
        System.loadLibrary("VendorAPIWrapperA");
          self = this;
    }
   
    static public VendorAPIWrapperA getInstance() {
          if( self == null ) {
                new VendorAPIWrapperA();
          }
          return self;
    }
   
    public native boolean IsStarted();
   
    public native String Connect(int piDeviceType, ObDev poObDev);
    public native String Disconnect(int piDeviceType);
   
    public native String SiuGetInfo(int piDeviceType);    
    public native String SiuGetCaps(int piDeviceType);    
    public native boolean SiuSetLockDoor(int piDeviceType, int piDoor, boolean pbLock);
    public native boolean SiuGetLockDoor(int piDeviceType, int piDoor);
   
   
}

=================================================================================================================

public class SpecifivDevice extends Device {

    private static Device SpecificDevice;
    private boolean isAvailable = false;
   
    public final static String DEVICE_NAME = "SIU";
   
    public SpecifivDevice {
        super(Device.CD_SIU, VendorAPIWrapperA.getInstance() );
        SpecifivDevice = this;
        this.Connect();
        if SpecificDevice;!= null) {
            //getCaps();
        }
    }
0
Comment
Question by:rubentrancoso
14 Comments
 
LVL 35

Expert Comment

by:girionis
Comment Utility
> Please check ERROR REPORT FILE for further information, if there is any.

Does that file give any clues?

Regards
0
 

Author Comment

by:rubentrancoso
Comment Utility
there's no file. Just the same log generated in crash.
---
Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xA4D212
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:

Dynamic libraries:
0x00400000 - 0x0040B000      C:\Arquivos de programas\Java\j2re1.4.2_05\bin\javaw.exe
0x78460000 - 0x784E1000      C:\WINNT\system32\ntdll.dll
0x792D0000 - 0x79332000      C:\WINNT\system32\ADVAPI32.dll
0x79720000 - 0x797DF000      C:\WINNT\system32\KERNEL32.DLL
0x77120000 - 0x77191000      C:\WINNT\system32\RPCRT4
(...)
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
These are nasty error because they occur outside the jvm. Can you try your application on a different computer and/or different java version?
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
Also, do you use any drivers to connect somewhere? If yes can you try upgrading?
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
rubentrancoso,

> But it works fine in test mode.

can you elaborate a bit? How do you run it in a test mode (through some IDE)? There is obviously somethign there that does not cause it to fail? Does the test mode use less resources/calls to the application?
0
 

Author Comment

by:rubentrancoso
Comment Utility
Unfortunatelly I dont's have another machine to test. The drivers are supplied by the vendor and it is already working in a vb context. But, yes. I ill try to reinstall this drivers and make a test with JVM 1.5.

0
 

Author Comment

by:rubentrancoso
Comment Utility
No, in test mode I just use a frame with tabs to each device and preload and connect all devices. The main difference from test to app is that the main process occour in a separated thread lauched by the main class that at it finish is lauched again.

In test mode I use to load 3 devices from a type of dll and 1 from the other. All devices uses a singleton that is the JNI wrapper.\

As I know when you do a loadlibrary you load a dll. But I dont know exactly what is happen here since the first driver loads xfs that uses the vendor api I need in the second one.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 35

Accepted Solution

by:
girionis earned 350 total points
Comment Utility
What I suggest

1) Try to upgrade drivers
2) try it on another installation of jvm and another computer
3) make sure that you use/have installed third-party dll according to the documentation provided.

These errors are nasty because they occur outside the jvm you can never be sure what exactly caused them :(
0
 
LVL 21

Assisted Solution

by:MogalManic
MogalManic earned 50 total points
Comment Utility
It could be a threading issue.  Try syncronizing the getInstance() method and/or the loadDocument() method.
0
 
LVL 7

Assisted Solution

by:JugglerW
JugglerW earned 100 total points
Comment Utility
The problem is absolutley sure outside the VM.
This type of crash occurs only with faulty JNI bindings (I know this from own experience :-) )
From your posted code the followoing native methods are candidates for the error.
Perhaps you can try them one after the other to get nearer to the error?
If you have not written the JNI code yourself you should contact the vendor of the library and send them the error report:

    public native boolean IsStarted();
   
    public native String Connect(int piDeviceType, ObDev poObDev);
    public native String Disconnect(int piDeviceType);
   
    public native String SiuGetInfo(int piDeviceType);    
    public native String SiuGetCaps(int piDeviceType);    
    public native boolean SiuSetLockDoor(int piDeviceType, int piDoor, boolean pbLock);
    public native boolean SiuGetLockDoor(int piDeviceType, int piDoor);
0
 

Author Comment

by:rubentrancoso
Comment Utility
The problem was temporaly solved but in a weird way. Thanks for the comments. I just put the line that invoke initdevices after the one that invoke the xml parsing. Ouch! I don't know why but now it works, but I think its unsafe. I will try to change the way XML is parsed to see if it is the problem like a coworker sugested, but it dont prove nothing.
I will still waiting for comments.
Thanks.
Ruben
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
Keep us posted of any progression :)
0
 

Author Comment

by:rubentrancoso
Comment Utility
Some news.
The upper layer of XFS driver isn't safe. You canot call any function without a sucessfull connect cause it receive structures and probably deal with nonallocated memory space causing this crash. To solve this I just used a flag ( boolean isConnected ) and just call commands when it is true. For now it is in respect a problems whit a specific device and not correspond in fact to the first condition of error. Next step will be rollback the first workaround to see if the problem was solved at all.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
:)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now