You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by littlenoodles <ry...@harris.com> on 2013/06/12 19:29:14 UTC

Dealing with javacore dumps calling POI via JNI

Hi.  I've got a C app that calls out to POI via a POIJNI wrapper I wrote. 
Since it's a write-only wrapper, most of the calls from C to POIJNI don't
return any values.  And it mostly works well.

Today, though, a user caused the Java VM to dump (I copied the stack from
the resulting javacore file below - seems to be my PoiJni.writeFile method
calling out to HSSFWorkbook.write and having a memory allocation fail down
the line).  Anyway, the problem seems to be that I set the max memory to
128MB in my jvm and I need more.  But on top of that, my 'CallVoidMethod'
call returns after java dumps, and my app thinks the file was written
successfully.  I guess I figured if the JVM ever dumped, my calling app
would too, but that's not the case.  So I'm wondering how to test for the
fact that the JVM aborted.  Is there some status flag in the JNIEnv struct 
(or query I can make) to monitor the health of the JVM to detect when it dumps?

1STGCHTYPE     GC History
3STHSTTYPE     16:49:13:333019000 GMT j9mm.126 -   at 216B49C0
poijni/PoiJni.writeFile(Ljava/lang/St
ring;)V, jit 00000000, pc 21771FCA
3STHSTTYPE     16:49:13:333017000 GMT j9mm.126 -   at 216B9748
org/apache/poi/hssf/usermodel/HSSFWor
kbook.write(Ljava/io/OutputStream;)V, jit 00000000, pc 217C3C2D
3STHSTTYPE     16:49:13:333014000 GMT j9mm.126 -   at 216B9758
org/apache/poi/hssf/usermodel/HSSFWor
kbook.getBytes()[B, jit 20B01164, pc 20304950
3STHSTTYPE     16:49:13:333009000 GMT j9mm.101 -  
J9AllocateIndexableObject() returning NULL! 16978
328 bytes requested for object of class 21377768 from memory space ''
id=00000000
3STHSTTYPE     16:49:13:332973000 GMT j9mm.53 -   GlobalGC end:
workstackoverflow=0 overflowcount=0
weakrefs=17 soft=0 phantom=0 finalizers=52 newspace=0/0
oldspace=13720344/134217728 loa=0/0



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Dealing with javacore dumps calling POI via JNI

Posted by littlenoodles <ry...@harris.com>.
littlenoodles <ryampols <at> harris.com> writes:

Ummm.  I guess this was obvious.  I should add calls to
(*env)->ExceptionOccurred(env) after each of my JNI calls.

I guess I can do that for each call, and only unhandled exceptions will be
reported - which I can then log and fail 'nicely'.  Then again, if the JVM
is dumping, will I still be able to call ExceptionOccurred once it's dumped?

Since my exception seems to be an out of memory condition, is there any rule
of thumb for how much memory to allocate to a JVM that's going to be running
POI?  I'm giving it 128MB (which was basically from some boilerplate JVM
startup code somebody was nice enough to post here for me).  Since the old
XLS format only support 64000 rows, I guess there must be some reasonable
upper limit for buffering up a spreadsheet in POI and writing it out.

The spreadsheet in question had 26000 rows by 43 columns.  In CSV format,
it's only 7.4 MB.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org