[Libreoffice] Trying to diagnose base running extremely slowly

Andrew Haley aph at redhat.com
Thu Oct 20 02:55:11 PDT 2011


On 10/20/2011 08:08 AM, Stephan Bergmann wrote:
> On 10/19/2011 07:17 PM, Andrew Haley wrote:
>> On 10/19/2011 05:57 PM, Michael Meeks wrote:
>>>
>>> On Wed, 2011-10-19 at 17:32 +0200, Stephan Bergmann wrote:
>>>> What the LibO hsqldb code does a lot is call JNI's
>>>> Attach/DetachCurrentThread.  Googling around,
>>>> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6929067>  "Stack
>>>> guard pages should be removed when thread is detached" suggests that
>>>> reading /proc/self/maps might have been added into
>>>> Attach/DetachCurrentThread as part of a bug fix.  That would explain things.
>>>
>>> 	Good catch ! The irony ... :-) this Java bug was kindly fixed for us
>>> indirectly via Andrew Haley to address the bad stack page left around when
>>> we had run some java. That page was causing crashes in calc formula computation
>>> in large sheets.
>>>
>>> 	It seems we can't win at some stage here. Andrew - I wonder are other
>>> people getting frustrated by performance here too ? it seems there is
>>> some huge /proc/self/maps thrash as we enter/exit Java now on Linux.
>>
>> Hmmm, I thought this had been fixed.
>>
>> See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6978641
> 
> This might still hit us, if the LibO hsqldb code runs in the main thread 
> (which I'm pretty sure it does).  That code calls 
> Attach/DetachCurrentThread frequently.

I suppose that code was written with the assumption that
Attach/DetachCurrentThread is cheap.  Checking for the guard pages is
not madly expensive, though: it's only parsing the memory map in a
very simple way.  Having said that, my original patch was rewritten in
a way that makes it run much more slowly because it's now using
unbuffered rather than buffered I/O.

> I think the best solution here would be to change the LibO hsqldb code, 
> to call Attach/DetachCurrentThread rarely rather than frequently, but 
> according to Ocke Janssen (who used to maintain that code) that was no 
> easy option.

Or just move it onto a subthread.

Andrew.


More information about the LibreOffice mailing list