Issue 57753 - Fix JNI-UNO bridge so that the JVM doesn't run out of memory when a destructor locks the SolarMutex
Summary: Fix JNI-UNO bridge so that the JVM doesn't run out of memory when a destructo...
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 2.0
Hardware: All All
: P2 Trivial (vote)
Target Milestone: OOo 2.0.2
Assignee: chne
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-11 16:23 UTC by mtg
Modified: 2006-02-26 18:47 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
CXX file for JNI Finalizer (4.60 KB, text/plain)
2005-11-11 16:25 UTC, mtg
no flags Details
HXX file for JNI Finalizer (3.58 KB, text/plain)
2005-11-11 16:26 UTC, mtg
no flags Details
patch to jni_java2uno.cxx (1.34 KB, text/plain)
2005-11-11 16:41 UTC, mtg
no flags Details
Test Case which kills office. (27.86 KB, application/octet-stream)
2005-11-15 13:18 UTC, mtg
no flags Details
Better test case, which doesn't require SDK (30.30 KB, application/octet-stream)
2005-11-15 14:01 UTC, mtg
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description mtg 2005-11-11 16:23:34 UTC
Hi there,

As discussed on the udk-dev list, there is a bug in the JNI-UNO bridge, as the
JVM's finalizer thread can block if a destructor wishes to acquire the
SolarMutex while another thread has already locked it. This results in the JVM
garbage collection being stalled, and as a result, it will throw a
java.lang.OutOfMemoryError.

The attached patch creates a FinalizerThreadPool singleton which holds a queue
of objects to be released. The JVM finalizer thread then just adds an object to
the queue and returns immediately. The FinalizerThreadPool will then share out
the objects to be released to it's various child threads.

I will create a reduced test case to demonstrate the error in action.
Comment 1 mtg 2005-11-11 16:25:10 UTC
Created attachment 31376 [details]
CXX file for JNI Finalizer
Comment 2 mtg 2005-11-11 16:26:11 UTC
Created attachment 31377 [details]
HXX file for JNI Finalizer
Comment 3 mtg 2005-11-11 16:41:50 UTC
Created attachment 31379 [details]
patch to jni_java2uno.cxx
Comment 4 mtg 2005-11-15 13:18:11 UTC
Created attachment 31513 [details]
Test Case which kills office.
Comment 5 mtg 2005-11-15 14:01:43 UTC
Created attachment 31515 [details]
Better test case, which doesn't require SDK
Comment 6 mtg 2005-11-15 15:18:47 UTC
Assigning the bug to myself
Comment 7 mtg 2005-11-15 16:35:46 UTC
The Great Work has begun..
Comment 8 mtg 2005-11-16 16:32:57 UTC
This issue is fixed in CWS mtg1. Marking this bug as fixed and CWS mtg1 as
'Ready for QA'
Comment 9 Stephan Bergmann 2005-11-17 13:28:54 UTC
successfully ran the relevant tests from
<http://udk.openoffice.org/common/man/draft/tests.html> for
unxlngi6.pro,unxsols4,wntmsci10.pro
Comment 10 Stephan Bergmann 2005-11-18 13:53:11 UTC
.
Comment 11 Stephan Bergmann 2005-11-18 14:20:49 UTC
.

re-open issue and reassign to cn@openoffice.org
Comment 12 Stephan Bergmann 2005-11-18 14:20:59 UTC
reassign to cn@openoffice.org
Comment 13 Stephan Bergmann 2005-11-18 14:21:06 UTC
reset resolution to FIXED
Comment 14 chne 2005-11-18 15:26:25 UTC
the verification of this issue needs an colmplete UNO-API-Test
Comment 15 chne 2005-12-22 12:30:45 UTC
cn->mtg1: can you provide me office installation sets of this cws?
Comment 16 mtg 2006-01-03 15:03:36 UTC
mtg->cn: I've uploaded an install set to here:

http://ooomisc.services.openoffice.org/pub/OpenOffice.org/cws/upload/mtg1.exe

Hope this helps, and the patch will make it into 2.0.2!

Thanks.
Comment 17 chne 2006-01-06 15:13:58 UTC
UNO-API-Tests run successfull on wntmsci => verified
Comment 18 chne 2006-02-26 18:47:49 UTC
ok in src680_m151 => zu