Bug 39467 - Crash when opening new document from particular EXTENSION
Summary: Crash when opening new document from particular EXTENSION
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
3.4.1 release
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Thorsten Behrens (allotropia)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-22 01:27 UTC by Ludovic SMADJA
Modified: 2011-10-03 03:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
the crash olog of the JVM (124.88 KB, text/x-log)
2011-07-22 01:27 UTC, Ludovic SMADJA
Details
Mock web application (8.09 KB, application/x-extension-war)
2011-07-25 02:27 UTC, Ludovic SMADJA
Details
Mock data (should be present in /tmp/mockDirectory) (10.96 KB, application/x-compressed-tar)
2011-07-25 02:28 UTC, Ludovic SMADJA
Details
I think we should do this at least (744 bytes, patch)
2011-07-28 02:32 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic SMADJA 2011-07-22 01:27:30 UTC
Created attachment 49418 [details]
the crash olog of the JVM

Hi everyone,

I'm developping an extension to link libreoffice and my product. In this extension, user can open a document from a list in LibreOffice (tested with writer and calc document).

In some case that I can't qualified, LO crash the JVM when opening the document. The problem is located in native code.

The crash is outside the extension (all my code are correctly executed) but appears only when extension is loaded.

I think that I'm writing someting incorrect but I can't see what. Therefore the crash should not occurs and that's why I file this bugs.

Here's the log of the JVM crash :

Regards,

Ludovic SMADJA
JALIOS SA
Comment 1 Rainer Bielefeld Retired 2011-07-22 04:19:07 UTC
Crash with experimental Extension will not block.

@Ludovic SMADJA 
I believe for debugging we will need the Extension, Manual, ...
You should subscribe and ask for support on libreoffice@lists.freedesktop.org
Comment 2 Ludovic SMADJA 2011-07-22 05:37:45 UTC
(In reply to comment #1)
> Crash with experimental Extension will not block.
> 
> @Ludovic SMADJA 
> I believe for debugging we will need the Extension, Manual, ...
> You should subscribe and ask for support on libreoffice@lists.freedesktop.org

I was afraid of that.

My extension need to have our product correctly installed and available which will be a quite difficult for you to have.

I 'll prepare a version of the extension with the problem and some mock classes in order to provide you some data to work.

It's not normal that an extension crash LO and that why I has filed this bug.

Regards,

Ludovic
Comment 3 Ludovic SMADJA 2011-07-25 02:26:17 UTC
Here's a way to reproduce the problem :

First install some mock data.

- install tomcat server ( 6.0.26 for me) and configure it basicaly

- deploy provided JcmsMock.war inside. This web application is intended to simulate my product, in order to make the extension work.

-to work, the mock application needs some file in /tmp/mockDirectory (which are provided by mockDirectory.tgz

The step to reproduce is :

 - start libreoffice with the extension (from netbeans for example).
 - create a new site with these parameters :

   name : local
   url : http://localhost:8080/JcmsMock/
   user : admin
   password : admin

- a list of available documents is shown, click on the image of the first line (all others lines doesn't have any mock data)

- extension is downloading the file and trying to open the file (which can be seen brievely)
- After that, extension have finished its work and LO crash (JVM crash in libtklx.so).


I provides a screencast in which I show these step.

regards,

Ludovic SMADJA
Comment 4 Ludovic SMADJA 2011-07-25 02:27:06 UTC
Created attachment 49491 [details]
Mock web application
Comment 5 Ludovic SMADJA 2011-07-25 02:28:00 UTC
Created attachment 49492 [details]
Mock data (should be present in /tmp/mockDirectory)
Comment 6 Ludovic SMADJA 2011-07-25 02:57:25 UTC
Additional files are too large (netbeans project and screencast).

However they can be downloaded from our private platform :

http://private.jalios.com

login : loteam
password : loteam
Comment 7 Ludovic SMADJA 2011-07-27 01:34:33 UTC
Just for information, I've continue my extension development (add some component in toolPanel), waiting this issue to release my extension.

I've tested under windows XP with L0 3.4.1 and I've a crash with the same step to reproduce.

The problem under windows is located inside tkmi.dll (info extracted from jvm crash log). It can help.

regards,

Ludovic
Comment 8 Caolán McNamara 2011-07-27 07:27:15 UTC
really need to get some symbols in there. If you were able to build your own Linux LibreOffice with configure option --enable-symbols to build it with -g and then run it under gdb we'd have some line numbers and so forth which would make it easier to have a look.

There's quite a bit of apparent involved manual setup time to get to see this crash which is off-putting given the number of lower-hanging fruit unfortunately. But a backtrace with line numbers might help push it over the boundary.
Comment 9 Ludovic SMADJA 2011-07-27 08:36:24 UTC
Ok, With the help of Michael Meeks (mmeeks) on libreoffice-dev channel, I've installed debug version of LO.

Here's the stacktrace of the error :


Program received signal SIGSEGV, Segmentation fault.
0x00007f5a87edec33 in UnoControl::createPeer (this=0x294e810, rxToolkit=..., rParentPeer=...) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/toolkit/source/controls/unocontrol.cxx:1357
(gdb) bt
#0  0x00007f5a87edec33 in UnoControl::createPeer (this=0x294e810, rxToolkit=..., rParentPeer=...) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/toolkit/source/controls/unocontrol.cxx:1357
#1  0x00007f5a87ee8dde in UnoControlContainer::impl_createControlPeerIfNecessary (this=0x2c45b10, _rxControl=...) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/toolkit/source/controls/unocontrolcontainer.cxx:649
#2  0x00007f5a87ee8ef4 in UnoControlContainer::impl_addControl (this=0x2c45b10, _rxControl=..., _pName=0x7fff9dbfe1b0) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/toolkit/source/controls/unocontrolcontainer.cxx:662
#3  0x00007f5a87ee9074 in UnoControlContainer::addControl (this=0x2c45b10, rName=..., rControl=...) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/toolkit/source/controls/unocontrolcontainer.cxx:679
#4  0x00007f5a80d55d3e in callVirtualMethod (pThis=0x2c45dc8, nVtableIndex=<value optimized out>, pRegisterReturn=0x0, pReturnTypeRef=0xc96b60, bSimpleReturn=true, pStack=<value optimized out>, nStack=0, pGPR=0x7fff9dbfdff0, pFPR=0x7fff9dbfdfb0, nFPR=0, nGPR=<value optimized out>) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/src/libreoffice-ure-3.4.2.2/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:158
#5  0x00007f5a80d56578 in cpp_call (aVtableSlot=..., pReturnTypeRef=0xc96b60, nParams=2, pParams=0x28a3660, pUnoReturn=0x0, pUnoArgs=0x7fff9dbfe1a0, ppUnoExc=0x7fff9dbfe2d8, pThis=<value optimized out>) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/src/libreoffice-ure-3.4.2.2/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:395
#6  0x00007f5a80d56e26 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch (pUnoI=0x2e62ae0, pMemberDescr=0x21307f0, pReturn=0x0, pArgs=0x7fff9dbfe1a0, ppException=0x7fff9dbfe2d8) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/src/libreoffice-ure-3.4.2.2/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:589
#7  0x00007f5a644cb236 in jni_uno::Bridge::call_uno (this=0x21c70c0, jni=..., pUnoI=0x2e62ae0, member_td=0x21307f0, return_type=0xc96b60, nParams=2, pParams=0x28a3660, jo_args=0x7fff9dbfe638) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/src/libreoffice-ure-3.4.2.2/bridges/source/jni_uno/jni_java2uno.cxx:275
#8  0x00007f5a644cba20 in Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call (jni_env=<value optimized out>, jo_proxy=0x2e62ae0, bridge_handle=35418304, jo_method=<value optimized out>, jo_args=0x7fff9dbfe638) at /home/ludovic/dev/libreoffice/libreoffice-bootstrap-3.4.2.2/src/libreoffice-ure-3.4.2.2/bridges/source/jni_uno/jni_java2uno.cxx:552
#9  0x00007f5a6615db55 in ?? ()
#10 0x00007fff9dbfe5e0 in ?? ()
#11 0x00007f5a69bcaeb6 in jni_IsAssignableFrom () from /home/ludovic/dev/tools/java/jdk1.6.0_25/jre/lib/amd64/server/libjvm.so
#12 0x00007f5a6614c9a9 in ?? ()
#13 0x0000000000000000 in ?? ()
(gdb) 


On my source file, it correspond to a line in createPeer method :

xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );

more info will come soon !!
Comment 10 Caolán McNamara 2011-07-27 08:44:26 UTC
Reference< XView >  xView ( getPeer(), UNO_QUERY );
...
unocontrol.cxx:1357  xView->setZoom( aComponentInfos.nZoomX, ...

I wonder if the UNO_QUERY simply failed, and there is no support for XView 

i.e. that xView.is() is false

(and/or the getPeer().is() is false, and there isn't a peer at all)

UNO_QUERY to UNO_QUERY_THROW would make it throw an exception if the query's fail, seeing as the code assumes that it worked afterwards that'd be one logical change the code needs.

Assuming that getPeer().is() is false, that would suggest that xToolkit->createWindow( aDescr ) failed. So where to go depends on finding out if getPeer().is() is true or false around line 1346
Comment 11 Ludovic SMADJA 2011-07-27 09:19:44 UTC
After debug session completed, I confirm that getPeer() is null. The creation of the peer isn't successfull.

I will look at that tomorrow.

Ludovic
Comment 12 Ludovic SMADJA 2011-07-28 02:15:19 UTC
I avance, the problem is that the associated window cannot be created because of missing parent

it returns from  Window* VCLXToolkit::ImplCreateWindow at
toolkit/source/awt/vclxtoolkit.cxx, line 670.

I should have an unoException instead of a crash.
Comment 13 Caolán McNamara 2011-07-28 02:32:24 UTC
So..., is it the case that the type of window is 

a) one which does indeed need a parent window ?
b) the com::sun::star::awt::WindowDescriptor passed in doesn't have one, i.e. this is coming from the extension ?

i.e. that the necessary fix for us is to just throw an exception instead of crashing under these circumstances
Comment 14 Caolán McNamara 2011-07-28 02:32:58 UTC
Created attachment 49659 [details]
I think we should do this at least
Comment 15 Ludovic SMADJA 2011-07-28 02:54:04 UTC
crash have disappear with your patch and an unoException is thrown now.

Thanks for your help.

Ludovic
Comment 17 Ludovic SMADJA 2011-07-28 03:11:17 UTC
So it will be fixed in 3.4.2 or after that?
Comment 18 Caolán McNamara 2011-07-28 03:20:26 UTC
as it stands, 3.5.0. I presumed that it crashes because the extension itself requests a type of window which needs a parent, but no parent is set in the request, and that the request comes from the extension. So while throwing is the right thing for the toolkit to do, it would also be a good thing for the extension to provide the required parent/request a different type of windows in which case the problem also goes away and the crash/exception is avoided in the first place. Perhaps that's not the case though ?
Comment 19 Ludovic SMADJA 2011-07-28 03:29:42 UTC
Yes I think so.

I've checked my plugin and the code which is causing the problem is executed on "onLoad" event of an xEventBroadcaster.

The problems occurs when a new document is opened and my code received 2 "onLoad" event for the same source. The crash occurs on the second.  the first time the code correctly work.

Perhaps, my listener is reattached and lost some context data, I'll check.
Comment 20 Ludovic SMADJA 2011-07-28 03:36:20 UTC
The problem is well in event management.

My panel is recalled at document load, and add a new event listener which will cause the problem.

Thanks for your help