Issue 4835 - -invisible causes hang at loadComponentFromURL()
Summary: -invisible causes hang at loadComponentFromURL()
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 1.0.0
Hardware: Sun Solaris
: P3 Trivial (vote)
Target Milestone: ---
Assignee: andreas.schluens
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-14 11:19 UTC by jameslee
Modified: 2002-07-16 12:31 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description jameslee 2002-05-14 11:19:36 UTC
When starting with "-invisible" it hangs after a few cylces (5 in my the test
I've just done, but it varies).
soffice -invisible

I'm driving through the API from Java. I have use a trivial document with just
"abc" in it. It is MSWord formant, It I test without the flag it runs, add the
flag and it hangs. I can't see what it's doing because ... it's invisible.


My soffice command:

$OFFICE/soffice -invisible
"-accept=socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" &





After a while I send an interrupt because I've had no action and OO throws this:
ceManager" &

com.sun.star.uno.RuntimeException:
com.sun.star.lib.uno.environments.remote.JobQueue.removeJob -
unexpected:java.lang.InterruptedException: operation interrupted
	at java.lang.Throwable.fillInStackTrace(Native Method)
	at java.lang.Throwable.fillInStackTrace(Compiled Code)
	at com.sun.star.lib.uno.environments.java.Proxy.invoke(Compiled Code)
	at com.sun.star.lib.sandbox.generic.DispatcherAdapterBase.invokeSec(Compiled
Code)
	at com.sun.star.lib.sandbox.generic.DispatcherAdapterBase.invokeL(Compiled
Code)
	at
JSGencom_sun_star_frame_XComponentLoadercom_sun_star_lib_uno_environments_java_Proxy.loadComponentFromURL(Unknown
Source)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Compiled Code)
	at
com.sun.star.lib.uno.environments.java.java_environment$HolderProxy.invoke(Compiled
Code)
	at com.sun.star.lib.sandbox.generic.DispatcherAdapterBase.invokeSec(Compiled
Code)
	at com.sun.star.lib.sandbox.generic.DispatcherAdapterBase.invokeL(Compiled
Code)
	at
JSGencom_sun_star_frame_XComponentLoadercom_sun_star_lib_uno_environments_java_java_environment_HolderProxy.loadComponentFromURL(Unknown
Source)
	at james.staroffice.Convert.doOffice(Convert.java:333)
	at james.staroffice.Convert.doIt3(Compiled Code)
	at james.staroffice.Convert.doIt2(Convert.java:231)
	at james.staroffice.Convert.run(Convert.java:198)


the open properties are:
		readProperty[i] = new PropertyValue();
		readProperty[i].Name = "ReadOnly";
		readProperty[i].Value = oTrue;

		i++;
		readProperty[i] = new PropertyValue();
		readProperty[i].Name = "Silent";
		readProperty[i].Value = oTrue;

		i++;
		readProperty[i] = new PropertyValue();
		readProperty[i].Name = "Hidden";
		readProperty[i].Value = oTrue;

		i++;
		readProperty[i] = new PropertyValue();
		readProperty[i].Name = "OpenNewView";
		readProperty[i].Value = oTrue;

The get loader is:
	private XComponentLoader getLoader()
		throws RestartError
	{
		if (Site.Verbose) Site.log.out.println("Convert:" + index + ":getLoader()
...");
		if (Site.Verbose) Site.log.out.println("Convert: Site.OfficeArgv = ``" +
Site.OfficeArgv + "''");

		XComponentLoader xComponentLoader = null;

		try {
			XMultiServiceFactory xmultiservicefactory =
com.sun.star.comp.helper.Bootstrap.createSimpleServiceManager();
			XUnoUrlResolver xurlresolver = (XUnoUrlResolver)
UnoRuntime.queryInterface(XUnoUrlResolver.class, 
						
xmultiservicefactory.createInstance("com.sun.star.bridge.UnoUrlResolver"));
			Object objectInitial = xurlresolver.resolve(Site.OfficeArgv);
			xmultiservicefactory = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, objectInitial);
			xComponentLoader = (XComponentLoader)
UnoRuntime.queryInterface(XComponentLoader.class, 
									xmultiservicefactory.createInstance("com.sun.star.frame.Desktop"));
			xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, 
									xmultiservicefactory.createInstance("com.sun.star.frame.Desktop"));
		//	xDesktop.terminate();

		} catch (Exception ohpooh) {
		//	if (Site.Verbose) ohpooh.printStackTrace(Site.log.out);
			throw new RestartError(ohpooh.getMessage());
		}

		if (xComponentLoader == null) {
			throw new RestartError("XComponentLoader is null");
		}

		if (Site.Verbose) Site.log.out.println("Convert:" + index + ": ... getLoader()
done");

		return xComponentLoader;
	}


and the open statements where it hangs are:

		try {
			if (xComponentLoader == null) {
				xComponentLoader = getLoader();
			}
		} catch (RunError error) {		
			// error.printStackTrace(Site.log.out);
			throw error;
		}
		

		if (Site.Verbose) Site.log.out.println("Convert:" + index +
":xComponentLoader.loadComponentFromURL() ...");
		try {

			xComponent = xComponentLoader.loadComponentFromURL(fromURL, Site.Frame,
com.sun.star.frame.FrameSearchFlag.AUTO, readProperty);
			if (xComponent == null) {
				throw new RunError("loadComponentFromURL() returned null");
			}



and "loadComponentFromURL" is line 333 in my code.


This generate my restartException which, yes, restarts OO, after which the file
always works, it is then another cycle which fails.  With no "-invisible" it
always works.


James Lee.
Comment 1 kay.ramme 2002-06-03 17:17:56 UTC
This seems to be yours?
Comment 2 Mathias_Bauer 2002-06-21 14:58:48 UTC
MBA->AS: 
Please have a look, if this bug is reproducable, we should fix it in
the next release.
Comment 3 andreas.schluens 2002-06-24 09:07:40 UTC
Sorry - not reproducable. Please provide mor informations.

- which office 
build?
- may a stack trace, which shows the office side at this time
- your full java 
code
- use you the office bean ?

Please note: FrameSearchFlag.AUTO isn't 
supported realy. Because it's not a valid combination of right search flags. If you 
say - your call works fine (if invisible isn't used) so I mention you use "_blank" as 
"Site.Frame". Is it true? If "Site.Frame" is a valid name of an already existing frame 
(e.g. "myFrame01") then you must use CHILDREN instead of AUTO. Otherwhise I think 
your call must fail everytime. But thats not a reason for a deadlock.
Comment 4 andreas.schluens 2002-07-01 08:31:24 UTC
Sorry - I couldnt reproduce this behaviour. Using your last provided java example runs 
for more then 2000 cycles without any problems.
seen on a windows pc (1 cpu) and an 
ultra sparc 80 (2 cpu)
tested with and(!) without -invisible
tested with word, 
writer and other documents

I've forwarded this bug to our internal API testing. 
But if they doesnt find anything too - we must close this bug as "non 
reproducable".

Andreas->James Lee: Please provide some stacks from office side 
which may show a deadlock or some other strange things.
Comment 5 andreas.schluens 2002-07-02 07:17:03 UTC
I found the problem. We have a special feature - a quit timer, which tries to terminate 
the application if last windows was gone. This timer runs 5 sec and checks for new 
opened documents. But on using large documents this time isn't may be 
enough.

Solution: Disable this fetaure (means the timer) for an office, which 
runs in mode "-invisible" & "-server". In this case the outside user has to finish the 
application.

Workarounds:
1) Open an empty document which hold the 
application alive
2) be frame::XTerminateListener on the desktop instance to 
hinder the application on shutdown
3) use the same frame for all open documents 
WITHOUT(!) closing it
Comment 6 andreas.schluens 2002-07-02 08:26:08 UTC
I`ve disabled the quit timer for some further command line arguments.
Comment 7 andreas.schluens 2002-07-16 12:31:14 UTC
We fixed it for our internal version srx643 j and was able to load more then 1000 
documents without any crash or deadlock. Of course it may depend from the used 
documents. But in general it should work now.