(tid=3) Unexpected connection closure

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

(tid=3) Unexpected connection closure

Lukasz Szybalski
I started using headless package more often, but I'm struggling
through connection problems.

1. How can I debug to see what happened to the connection?
2. Is there some trace other then unexpected connection closure?
3. Is there a way to re-establish the connection, or tell it not to
close but return an error that it can't do something?



Traceback (most recent call last):
 File "/usr/local/bin/xyz60.py", line 198, in <module>
   cursor2.gotoEnd(False)
__main__.DisposedException: URP_Bridge : disposed
(tid=3) Unexpected connection closure


Thanks,
Lucas


On Tue, Sep 1, 2009 at 2:29 PM, Lukasz Szybalski <[hidden email]> wrote:

> Hello,
>
> Based on some work that was done by
> http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python
> I've created a ootools package that allows you to start openoffice in
> just 2 lines of python code. It requires openoffice -headless and
> oo2.4+. Install it and give it a try.
>
>
> ---How to install it ---
>
> easy_install ootools
> or
> sudo easy_install ootools
>
> -- How to use it --
>
> python
> import ootools
> oor=ootools.OORunner()
> oor.start()
>
> # open office headless should start on port 8100.
> #Check using command: netstat -atpen | grep soffice
> #To stop it do:
>
> oor.stop()
>
>
> -- How to get desktop object --
>
> import ootools
> oor=ootools.OORunner()
> oor.start()
> desktop=oor.connect()
> #Do something with the desktop.
>
> #When done
> oor.close()
>
>
> Give it a try and let me know. It works correctly under Debian lenny 32bit.
>
> What os you have system, path to open office,etc.
>
> Thanks,
> Lucas
>



--
Setup CalendarServer for your company.
http://lucasmanual.com/mywiki/CalendarServer
Automotive Recall Database - See if you vehicle has a recall
http://lucasmanual.com/recall

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (tid=3) Unexpected connection closure

Kay Ramme - Sun Germany - Hamburg
Hi Lukasz,

this is a Python question, right?

Typically connections die, because one of the hosts get disconnected or
one of the applications do terminate.

Do you have a hint, which case is yours?

Regards

     Kay


Lukasz Szybalski wrote:

> I started using headless package more often, but I'm struggling
> through connection problems.
>
> 1. How can I debug to see what happened to the connection?
> 2. Is there some trace other then unexpected connection closure?
> 3. Is there a way to re-establish the connection, or tell it not to
> close but return an error that it can't do something?
>
>
>
> Traceback (most recent call last):
>  File "/usr/local/bin/xyz60.py", line 198, in <module>
>    cursor2.gotoEnd(False)
> __main__.DisposedException: URP_Bridge : disposed
> (tid=3) Unexpected connection closure
>
>
> Thanks,
> Lucas
>
>
> On Tue, Sep 1, 2009 at 2:29 PM, Lukasz Szybalski <[hidden email]> wrote:
>> Hello,
>>
>> Based on some work that was done by
>> http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python
>> I've created a ootools package that allows you to start openoffice in
>> just 2 lines of python code. It requires openoffice -headless and
>> oo2.4+. Install it and give it a try.
>>
>>
>> ---How to install it ---
>>
>> easy_install ootools
>> or
>> sudo easy_install ootools
>>
>> -- How to use it --
>>
>> python
>> import ootools
>> oor=ootools.OORunner()
>> oor.start()
>>
>> # open office headless should start on port 8100.
>> #Check using command: netstat -atpen | grep soffice
>> #To stop it do:
>>
>> oor.stop()
>>
>>
>> -- How to get desktop object --
>>
>> import ootools
>> oor=ootools.OORunner()
>> oor.start()
>> desktop=oor.connect()
>> #Do something with the desktop.
>>
>> #When done
>> oor.close()
>>
>>
>> Give it a try and let me know. It works correctly under Debian lenny 32bit.
>>
>> What os you have system, path to open office,etc.
>>
>> Thanks,
>> Lucas
>>
>
>
>


--
Sun Microsystems GmbH           Kay Ramme
Sachsenfeld 4                   Senior Technical Architect
20097 Hamburg                   Phone: (+49 40) 23646 982
Germany                         Fax:   (+49 40) 23646 550
http://www.sun.com/staroffice   mailto:[hidden email]
http://www.sun.com/openoffice
http://udk.openoffice.org
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (tid=3) Unexpected connection closure

Lukasz Szybalski
On Mon, Nov 9, 2009 at 2:29 AM, Kay Ramme <[hidden email]> wrote:
> Hi Lukasz,
>
> this is a Python question, right?
>
> Typically connections die, because one of the hosts get disconnected or one
> of the applications do terminate.
>
> Do you have a hint, which case is yours?
>

It seems as there is a exception in openoffice services. Service
terminates without sending back an error message, and its no longer
listening on the port.

When that happens I get a message on the next oo call that the
connection was lost. So at this point I'm looking for a way for oo to
tell me that it failed, or look at some log that oo? creates to see
why it failed? Is there a log for the headless services oo is running?

Thanks,
Lucas


> Regards
>
>    Kay
>
>
> Lukasz Szybalski wrote:
>>
>> I started using headless package more often, but I'm struggling
>> through connection problems.
>>
>> 1. How can I debug to see what happened to the connection?
>> 2. Is there some trace other then unexpected connection closure?
>> 3. Is there a way to re-establish the connection, or tell it not to
>> close but return an error that it can't do something?
>>
>>
>>
>> Traceback (most recent call last):
>>  File "/usr/local/bin/xyz60.py", line 198, in <module>
>>   cursor2.gotoEnd(False)
>> __main__.DisposedException: URP_Bridge : disposed
>> (tid=3) Unexpected connection closure
>>
>>
>> Thanks,
>> Lucas
>>
>>
>> On Tue, Sep 1, 2009 at 2:29 PM, Lukasz Szybalski <[hidden email]>
>> wrote:
>>>
>>> Hello,
>>>
>>> Based on some work that was done by
>>>
>>> http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python
>>> I've created a ootools package that allows you to start openoffice in
>>> just 2 lines of python code. It requires openoffice -headless and
>>> oo2.4+. Install it and give it a try.
>>>
>>>
>>> ---How to install it ---
>>>
>>> easy_install ootools
>>> or
>>> sudo easy_install ootools
>>>
>>> -- How to use it --
>>>
>>> python
>>> import ootools
>>> oor=ootools.OORunner()
>>> oor.start()
>>>
>>> # open office headless should start on port 8100.
>>> #Check using command: netstat -atpen | grep soffice
>>> #To stop it do:
>>>
>>> oor.stop()
>>>
>>>
>>> -- How to get desktop object --
>>>
>>> import ootools
>>> oor=ootools.OORunner()
>>> oor.start()
>>> desktop=oor.connect()
>>> #Do something with the desktop.
>>>
>>> #When done
>>> oor.close()
>>>
>>>
>>> Give it a try and let me know. It works correctly under Debian lenny
>>> 32bit.
>>>
>>> What os you have system, path to open office,etc.
>>>
>>> Thanks,
>>> Lucas
>>>
>>
>>
>>
>
>
> --
> Sun Microsystems GmbH           Kay Ramme
> Sachsenfeld 4                   Senior Technical Architect
> 20097 Hamburg                   Phone: (+49 40) 23646 982
> Germany                         Fax:   (+49 40) 23646 550
> http://www.sun.com/staroffice   mailto:[hidden email]
> http://www.sun.com/openoffice
> http://udk.openoffice.org
> Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
> Amtsgericht München: HRB 161028
> Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
> Vorsitzender des Aufsichtsrates: Martin Häring
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
Setup CalendarServer for your company.
http://lucasmanual.com/mywiki/CalendarServer
Automotive Recall Database - See if you vehicle has a recall
http://lucasmanual.com/recall

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (tid=3) Unexpected connection closure

et.gaudrain
Hi Lucas,

Here are two things you may try :

- use a pipe connection instead of a socket connection, and see if you
still lost connection

- check that the OOo process is still running. Actually, you may want to
use the subprocess module instead of the os one (you just be loosing
compatibility with Python 2.3). You would be able to grab errors from
the stderror channel of your process. I don't know if it throw any
message there, but in case it does, you'd be able to read it.


Regards,
-Etienne


Lukasz Szybalski wrote:

> On Mon, Nov 9, 2009 at 2:29 AM, Kay Ramme <[hidden email]> wrote:
>  
>> Hi Lukasz,
>>
>> this is a Python question, right?
>>
>> Typically connections die, because one of the hosts get disconnected or one
>> of the applications do terminate.
>>
>> Do you have a hint, which case is yours?
>>
>>    
>
> It seems as there is a exception in openoffice services. Service
> terminates without sending back an error message, and its no longer
> listening on the port.
>
> When that happens I get a message on the next oo call that the
> connection was lost. So at this point I'm looking for a way for oo to
> tell me that it failed, or look at some log that oo? creates to see
> why it failed? Is there a log for the headless services oo is running?
>
> Thanks,
> Lucas
>
>
>  
>>
>
>
>
>  


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Etienne Gaudrain
Centre for the Neural Basis of Hearing
Department of Physiology, Development and Neuroscience
University of Cambridge
Downing Street
Cambridge CB2 3EG
UK
Phone: +44 1223 765 359 office
Fax: +44 1223 333 840 department
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (tid=3) Unexpected connection closure

Lukasz Szybalski
On Mon, Nov 9, 2009 at 9:01 AM, Etienne Gaudrain <[hidden email]> wrote:
> Hi Lucas,
>
> Here are two things you may try :
>
> - use a pipe connection instead of a socket connection, and see if you still
> lost connection
>

ok. lets try the pipe..
What is the difference between socket and a pipe as far as oo?  Can I
start multiple instances of oo with different pipe names and then use
these pipe names for multiple programs that start around the same
time?


doing....
changed the startup from

/usr/bin/openoffice -accept="socket,host=localhost,port=8100;urp;"
-norestore -nologo -headless -nofirstwizard
to
/usr/bin/openoffice -accept="pipe,name=localhost_app;urp;" -norestore
-nofirstwizard -nologo -headless


Now in the code I did:

import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.connection import NoConnectException
localContext = uno.getComponentContext()
resolver     = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
localContext)
context      = None
context = resolver.resolve("uno:pipe,name=localhost_app;urp;StarOffice.ComponentContext")
desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",
context)


but still get the connection lost....no change...(I wonder if I can
use the NoConnectException somehow??)

troubleshooting....

I've tried recreating the cursor every time the new section/action
needs to be done. This has improved the process but still 1/5 fail in
headless.
What I noticed is that if headless process crashes, I can start the
non-headless process and that will finish just fine, so it seems as
headless startup will lose connection more often then the non headless
one.

Since I start and stop oo from the script I really need to get the
headless package to work properly.


> - check that the OOo process is still running. Actually, you may want to use
> the subprocess module instead of the os one (you just be loosing
> compatibility with Python 2.3). You would be able to grab errors from the
> stderror channel of your process. I don't know if it throw any message
> there, but in case it does, you'd be able to read it.

There are no error messages when oo crashes. If I start the oo on the
socket then process is still running but its no longer listening on
the socket.
This will show a lot of soffice processes after few days of running
the process in cron....   ps -ea | grep soffice
But this command will show that none of them are listening
anymore...netstat -atpen | grep soffice

As far as pipe, i see its closing right now but I would need few days
to see if the process closes when using cron?

Ideas?
Thanks,
Lucas


>
>
> Regards,
> -Etienne
>
>
> Lukasz Szybalski wrote:
>>
>> On Mon, Nov 9, 2009 at 2:29 AM, Kay Ramme <[hidden email]> wrote:
>>
>>>
>>> Hi Lukasz,
>>>
>>> this is a Python question, right?
>>>
>>> Typically connections die, because one of the hosts get disconnected or
>>> one
>>> of the applications do terminate.
>>>
>>> Do you have a hint, which case is yours?
>>>
>>>
>>
>> It seems as there is a exception in openoffice services. Service
>> terminates without sending back an error message, and its no longer
>> listening on the port.
>>
>> When that happens I get a message on the next oo call that the
>> connection was lost. So at this point I'm looking for a way for oo to
>> tell me that it failed, or look at some log that oo? creates to see
>> why it failed? Is there a log for the headless services oo is running?
>>
>> Thanks,
>> Lucas
>>
>>
>>
>>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (tid=3) Unexpected connection closure

Kay Ramme - Sun Germany - Hamburg
Hi Lucasz,

if I understand your other mail correctly, the office dies for some
reason. You may want to attach a debugger or something to see what happens.

How are you actually starting the office process? If it is under your
control, you may want to issue a "wait" (or similar) system call. The
moment "wait" returns you know the process died.

Just try the non-headless approach to see if it does crash as well,
obviously headless and non-headless should behave the same wrt to the
API :-)

Regards

     Kay


Lukasz Szybalski wrote:

> On Mon, Nov 9, 2009 at 9:01 AM, Etienne Gaudrain <[hidden email]> wrote:
>> Hi Lucas,
>>
>> Here are two things you may try :
>>
>> - use a pipe connection instead of a socket connection, and see if you still
>> lost connection
>>
>
> ok. lets try the pipe..
> What is the difference between socket and a pipe as far as oo?  Can I
> start multiple instances of oo with different pipe names and then use
> these pipe names for multiple programs that start around the same
> time?
>
>
> doing....
> changed the startup from
>
> /usr/bin/openoffice -accept="socket,host=localhost,port=8100;urp;"
> -norestore -nologo -headless -nofirstwizard
> to
> /usr/bin/openoffice -accept="pipe,name=localhost_app;urp;" -norestore
> -nofirstwizard -nologo -headless
>
>
> Now in the code I did:
>
> import uno
> from com.sun.star.beans import PropertyValue
> from com.sun.star.connection import NoConnectException
> localContext = uno.getComponentContext()
> resolver     = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
> localContext)
> context      = None
> context = resolver.resolve("uno:pipe,name=localhost_app;urp;StarOffice.ComponentContext")
> desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",
> context)
>
>
> but still get the connection lost....no change...(I wonder if I can
> use the NoConnectException somehow??)
>
> troubleshooting....
>
> I've tried recreating the cursor every time the new section/action
> needs to be done. This has improved the process but still 1/5 fail in
> headless.
> What I noticed is that if headless process crashes, I can start the
> non-headless process and that will finish just fine, so it seems as
> headless startup will lose connection more often then the non headless
> one.
>
> Since I start and stop oo from the script I really need to get the
> headless package to work properly.
>
>
>> - check that the OOo process is still running. Actually, you may want to use
>> the subprocess module instead of the os one (you just be loosing
>> compatibility with Python 2.3). You would be able to grab errors from the
>> stderror channel of your process. I don't know if it throw any message
>> there, but in case it does, you'd be able to read it.
>
> There are no error messages when oo crashes. If I start the oo on the
> socket then process is still running but its no longer listening on
> the socket.
> This will show a lot of soffice processes after few days of running
> the process in cron....   ps -ea | grep soffice
> But this command will show that none of them are listening
> anymore...netstat -atpen | grep soffice
>
> As far as pipe, i see its closing right now but I would need few days
> to see if the process closes when using cron?
>
> Ideas?
> Thanks,
> Lucas
>
>
>>
>> Regards,
>> -Etienne
>>
>>
>> Lukasz Szybalski wrote:
>>> On Mon, Nov 9, 2009 at 2:29 AM, Kay Ramme <[hidden email]> wrote:
>>>
>>>> Hi Lukasz,
>>>>
>>>> this is a Python question, right?
>>>>
>>>> Typically connections die, because one of the hosts get disconnected or
>>>> one
>>>> of the applications do terminate.
>>>>
>>>> Do you have a hint, which case is yours?
>>>>
>>>>
>>> It seems as there is a exception in openoffice services. Service
>>> terminates without sending back an error message, and its no longer
>>> listening on the port.
>>>
>>> When that happens I get a message on the next oo call that the
>>> connection was lost. So at this point I'm looking for a way for oo to
>>> tell me that it failed, or look at some log that oo? creates to see
>>> why it failed? Is there a log for the headless services oo is running?
>>>
>>> Thanks,
>>> Lucas
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Sun Microsystems GmbH           Kay Ramme
Sachsenfeld 4                   Senior Technical Architect
20097 Hamburg                   Phone: (+49 40) 23646 982
Germany                         Fax:   (+49 40) 23646 550
http://www.sun.com/staroffice   mailto:[hidden email]
http://www.sun.com/openoffice
http://udk.openoffice.org
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]