Issue 82210 - bootstrap hangs one second run of program
Summary: bootstrap hangs one second run of program
Status: CONFIRMED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 2.2.1
Hardware: All Windows XP
: P3 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-03 11:52 UTC by gbo
Modified: 2013-07-30 02:36 UTC (History)
3 users (show)

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


Attachments
File That is open to show the hang (215.96 KB, text/plain)
2007-10-03 11:53 UTC, gbo
no flags Details
stacks of the office threads (3.80 KB, text/plain)
2007-12-04 16:30 UTC, joachim.lingner
no flags Details
a working document (6.26 KB, application/octet-stream)
2007-12-04 16:59 UTC, joachim.lingner
no flags Details
code without build errors (2.97 KB, text/plain)
2007-12-05 08:30 UTC, joachim.lingner
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description gbo 2007-10-03 11:52:09 UTC
I have a simple c# program that opens a doc hidden and closes it again, This is 
to just show this issue.

When I run the program a second time the call to bootstrap hangs, I have to 
then kill the program and soffice.bin before I can use any openoffice programs.

The document I am opening is the rtf spec saves a a odt file.

If I run it without hidden it does not have the issue. also if I run and 
connect to a socket its works.

I think it is to do with the number of tables in the document.

The code is in c# and run on windows XP.

Open Office is quick start is running.

Code...
###########################
using System;
using System.Collections.Generic;
using System.Text;
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.uno;
using unoidl.com.sun.star.bridge;
using unoidl.com.sun.star.frame;
using unoidl.com.sun.star.beans;


namespace OpenOfficeText
{
    class Program
    {
        //Define a file name. Change this to an existing path!  

        // file to open.
        private static string FileName = @"C:\Word 2002 RTF Specification\Word 
2002 RTF Specification Final.odt";

        [STAThread]
        static void Main(string[] args)
        {
            TestOpenOffice();
        }

        static void TestOpenOffice()
        {

            //Call the bootstrap method to get a new ComponentContext  
            //object. If OpenOffice isn't already started this will  
            //start it and then return the ComponentContext.  

            // this lines hangs on second run of program.
            unoidl.com.sun.star.uno.XComponentContext localContext =
              uno.util.Bootstrap.bootstrap();



            //Get a new service manager of the MultiServiceFactory type  
            //we need this to get a desktop object and create new CLI  
            //objects.  

            unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory =
                (unoidl.com.sun.star.lang.XMultiServiceFactory)
                localContext.getServiceManager();


            //Create a new Desktop instance using our service manager  
            //Notice: We cast our desktop object to XComponent loader  
            //so that we could load or create new documents.  

            XComponentLoader componentLoader =
               (XComponentLoader)multiServiceFactory.createInstance(
                  "com.sun.star.frame.Desktop");


            // Create without the GUI
            //sett the property 
            unoidl.com.sun.star.beans.PropertyValue[] propertyValue = new 
unoidl.com.sun.star.beans.PropertyValue[1];
            unoidl.com.sun.star.beans.PropertyValue aProperty = new 
unoidl.com.sun.star.beans.PropertyValue();
            aProperty.Name = "Hidden";
            aProperty.Value = new uno.Any(true);
            propertyValue[0] = aProperty;

            //Create a new blank writer document using our component  
            //loader object.  

            XComponent xComponent = componentLoader.loadComponentFromURL(
                //"private:stream",
               PathConverter(FileName),  
               "_blank", 0,       //into a blank frame use no searchflag  
                propertyValue
               );

            xComponent.dispose();
        }


         /// The converted file to URL 
        private static string PathConverter(string file)
        {
            try
            {
                file = file.Replace(@"\", "/");
                return "file:///" + file;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
    } 
}
###########################
Comment 1 gbo 2007-10-03 11:53:40 UTC
Created attachment 48668 [details]
File That is open to show the hang
Comment 2 kay.ramme 2007-10-10 09:36:05 UTC
->Jochen, could you please take care of this ? Thanks.
Comment 3 joachim.lingner 2007-12-04 16:26:51 UTC
The client process is not able to connect to the office. That is, the thread
that creates the connection is caught up in a for loop where it tries to connect
to the office via XUnoUrlResolver::resolve (cppuhelper/source/bootstrap.cxx,
bootstrap() )

Interestingly there is no problem when the "Hidden" property false. 
Comment 4 joachim.lingner 2007-12-04 16:30:04 UTC
Created attachment 50091 [details]
stacks of the office threads
Comment 5 joachim.lingner 2007-12-04 16:34:20 UTC
jl->as: Please have a look at the stacks which I attached.
Comment 6 joachim.lingner 2007-12-04 16:59:34 UTC
Created attachment 50092 [details]
a working document
Comment 7 joachim.lingner 2007-12-04 17:02:47 UTC
The bug does also not occur with the attached test.odt which is a very small
document. So the problem depends on:

1. The way loadComponentFromUrl is used
2. the document used.

jl->as: Please investigate further. Contact me if you need help with setting up
the test scenario.
Comment 8 joachim.lingner 2007-12-04 17:03:40 UTC
cc to myself.
Comment 9 joachim.lingner 2007-12-05 08:30:37 UTC
Created attachment 50107 [details]
code without build errors
Comment 10 joachim.lingner 2007-12-05 08:39:19 UTC
Notes for setting up the scenario:

1.Create a C# console application with VS 2003
2.Substitute the code with the one attached.
3.Add references to cli assemblies which are in office/program/assembly in the
solution explorer.

4.Install OOo completely, that is do not do an administrative installation.
Comment 11 andreas.schluens 2007-12-14 09:01:54 UTC
AS: This problem occures under very rare circumstances only.
a) It can be reproduced by using these special "Word RTF...odt" document only ..
b) in case it's loaded in hidden state ...
c) and using the remote uno bridge only (doesnt matter which language is used by
the client ... e.g. I've tried it with a small Java example).

It cant be reproduced by loading the same document inside the office process
(e.g. by using a small basic macro) nor by loading other documents. The set of
stacks attached to this issue doesnt show a classic deadlock. On some debug
sessions I've found out that there must be a memory corruption. First the uno
bridge detects some errors on reading bytes from the socket and close the
connection. That will match to the fact that the bridge was closed and no
further connections are possible ... But after that he office itself will become
unusable. No repaints will happen nor it can be used in general ... it's frozen
completely. But the mainthread wait's for messages ... but never will get one.
So it seams that the windows queue mechanism of windows itself was damaged at
this point.

This task needs some further investigations ... but it seams it can be finished
within a 2.4 time frame. So I will set a more approiate target.
Comment 12 bdangubic 2008-02-22 20:53:05 UTC
has this issue been fixed in 2.4 current release candidate?
Comment 13 andreas.schluens 2008-05-30 08:48:27 UTC
AS: Because it can be reproduced with the attached special test document only
(not with other documents) these task isnt a bug related to uno bootstrap in
real. Seams to be a problem of the document itself (more related to the filter!).
New target OOo Later.
Comment 14 robajz 2009-06-18 08:17:41 UTC
Hello, there's been a solution offered in the forum:
http://www.oooforum.org/forum/viewtopic.phtml?t=63543 by Thant Zin

Please search setup.xcu in your Program Files Folder.
Then open the file and replace
<prop oor:name="ooSetupInstCompleted">
<value>false</value>
</prop>
<prop oor:name="ooSetupShowIntro">
<value>true</value>
</prop>
with
<prop oor:name="ooSetupInstCompleted" oor:type="xs:boolean">
<value>true</value>
</prop>
<prop oor:name="LicenseAcceptDate" oor:type="xs:string">
<value>2008-12-25T17:34:04</value>
</prop>
<prop oor:name="FirstStartWizardCompleted" oor:type="xs:boolean">
<value>true</value>
</prop> 
Comment 15 Rob Weir 2013-07-30 02:36:55 UTC
Reset assignee on issues not touched by assignee in more than 1000 days.