running this: soffice "--accept=socket,host=localhost,port=2002;urp;" and also this: #!/usr/bin/python import uno class test(): def __init__(self): localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext ) ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" ) smgr = ctx.ServiceManager print 'smgr' desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx) print 'desktop' model = desktop.getCurrentComponent() vcl = smgr.createInstance("com.sun.star.resource.VclStringResourceLoader") print vcl # vcl.setValue("FileName", "test") if __name__ == "__main__": print 'test' test() fails nastily :-) like this (different line numbers) Traceback (most recent call last): File "test.py", line 27, in <module> test() File "test.py", line 16, in __init__ desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx) __main__.RuntimeException: Binary URP bridge disposed during call the exception trace is: Breakpoint 1, 0xb7a127e0 in __cxa_throw () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libstdc++.so.6 (gdb) bt #0 0xb7a127e0 in __cxa_throw () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libstdc++.so.6 #1 0xb6c232eb in binaryurp::Bridge::getWriter (this=0xb6c9d9b0) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:330 #2 0xb6c26c99 in binaryurp::Bridge::sendRequest (this=0xb6c9d9b0, tid=..., oid=..., type=..., member=..., inArguments=...) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:945 #3 0xb6c26be7 in binaryurp::Bridge::makeReleaseCall (this=0xb6c9d9b0, oid=..., type=...) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:936 #4 0xb6c24561 in binaryurp::Bridge::freeProxy (this=0xb6c9d9b0, proxy=...) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:500 #5 0xb6c3eb7d in binaryurp::Proxy::do_free (this=0x8118630) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:107 #6 0xb6c21f64 in binaryurp::(anonymous namespace)::freeProxyCallback (pProxy=0x8118630) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:97 #7 0xb7b3b925 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #8 0xb7b3facd in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #9 0xb7b3fb4a in uno_Environment_invoke_v () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #10 0xb7b3fb7d in uno_Environment_invoke () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #11 0xb7b385a7 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #12 0xb6c24504 in binaryurp::Bridge::revokeProxy (this=0xb6c9d9b0, proxy=...) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:495 #13 0xb6c3eb48 in binaryurp::Proxy::do_release (this=0x8118630) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:102 #14 0xb6c3e8c2 in binaryurp::(anonymous namespace)::proxy_releaseInterface (pInterface=0x8118630) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:61 #15 0xb6df7e91 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #16 0xb7b3b925 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #17 0xb7b3facd in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #18 0xb7b3fb4a in uno_Environment_invoke_v () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #19 0xb7b3fb7d in uno_Environment_invoke () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #20 0xb7b385a7 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #21 0xb6df8101 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #22 0xb6df6525 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #23 0xb6df7109 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #24 0xb7b5e099 in com::sun::star::uno::cpp_release(void*) () from /opt/OOInstall/basis3.4/program/pyuno.so #25 0xb7b33298 in uno_any_destruct () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #26 0xb7b5e2c6 in com::sun::star::uno::Any::~Any() () from /opt/OOInstall/basis3.4/program/pyuno.so #27 0xb7b63a02 in pyuno::PyUNO_callable_call(_object*, _object*, _object*) () from /opt/OOInstall/basis3.4/program/pyuno.so #28 0xb7ec2b40 in PyObject_Call (func=0xb7c6f130, arg=0xb7c325cc, kw=0x0) at Objects/abstract.c:2522 #29 0xb7ede4d3 in do_call (f=0x80d1e3c, throwflag=0) at Python/ceval.c:4230 #30 call_function (f=0x80d1e3c, throwflag=0) at Python/ceval.c:4035 #31 PyEval_EvalFrameEx (f=0x80d1e3c, throwflag=0) at Python/ceval.c:2665 #32 0xb7ee3e2f in PyEval_EvalCodeEx (co=0xb7c28da0, globals=0xb7c6e35c, locals=0x0, args=0xb7bd2378, argcount=1, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3252 #33 0xb7ec7a07 in function_call (func=0xb7bdce2c, arg=0xb7bd236c, kw=0x0) at Objects/funcobject.c:526 ---Type <return> to continue, or q <return> to quit--- #34 0xb7ec2b40 in PyObject_Call (func=0xb7bdce2c, arg=0xb7bd236c, kw=0x0) at Objects/abstract.c:2522 #35 0xb7ec39c0 in instancemethod_call (func=0xb7bdce2c, arg=0xb7bd236c, kw=0x0) at Objects/classobject.c:2578 #36 0xb7ec2b40 in PyObject_Call (func=0xb7bcf89c, arg=0xb7c3e02c, kw=0x0) at Objects/abstract.c:2522 #37 0xb7edc9c6 in PyEval_CallObjectWithKeywords (func=0xb7bcf89c, arg=0xb7c3e02c, kw=0x0) at Python/ceval.c:3881 #38 0xb7ec491b in PyInstance_New (klass=0xb7c3aa4c, arg=0xb7c3e02c, kw=0x0) at Objects/classobject.c:571 #39 0xb7ec2b40 in PyObject_Call (func=0xb7c3aa4c, arg=0xb7c3e02c, kw=0x0) at Objects/abstract.c:2522 #40 0xb7ede4d3 in do_call (f=0x805bc3c, throwflag=0) at Python/ceval.c:4230 #41 call_function (f=0x805bc3c, throwflag=0) at Python/ceval.c:4035 #42 PyEval_EvalFrameEx (f=0x805bc3c, throwflag=0) at Python/ceval.c:2665 #43 0xb7ee3fd9 in PyEval_EvalCodeEx (co=0xb7c2c578, globals=0xb7c6e35c, locals=0xb7c6e35c, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3252 #44 0xb7f13653 in PyEval_EvalCode (co=0xb7c2c578, globals=0xb7c6e35c, locals=0xb7c6e35c) at Python/ceval.c:666 #45 0xb7f21b0c in run_mod (mod=<value optimized out>, filename=<value optimized out>, globals=0xb7c6e35c, locals=0xb7c6e35c, flags=0xbfffefdc, arena=0x80cd2a8) at Python/pythonrun.c:1346 #46 0xb7f21fce in PyRun_FileExFlags (fp=0x8067ab0, filename=0xbffff2fd "test.py", start=257, globals=0xb7c6e35c, locals=0xb7c6e35c, closeit=1, flags=0xbfffefdc) at Python/pythonrun.c:1332 #47 0xb7f2276b in PyRun_SimpleFileExFlags (fp=0x8067ab0, filename=<value optimized out>, closeit=1, flags=0xbfffefdc) at Python/pythonrun.c:936 #48 0xb7f22d0a in PyRun_AnyFileExFlags (fp=0x8067ab0, filename=0xbffff2fd "test.py", closeit=1, flags=0xbfffefdc) at Python/pythonrun.c:740 #49 0xb7f2c3a7 in Py_Main (argc=2, argv=0xbffff0c4) at Modules/main.c:599 #50 0x08048687 in main () and the exception site: gdb) l 325 if (terminated_) { 326 throw css::lang::DisposedException( 327 rtl::OUString( 328 RTL_CONSTASCII_USTRINGPARAM( 329 "Binary URP bridge already disposed")), 330 static_cast< cppu::OWeakObject * >(this)); 331 } 332 OSL_ASSERT(writer_.is()); 333 return writer_;
The basic problem seems to be (put a break in 'shutdown') that we close the connection while we would still rather be reading & writing to it ;-) - magically, from another thread; thus: Thread 4 (Thread 0xb63ddb70 (LWP 23311)): #0 0xb7d54510 in shutdown () from /lib/libc.so.6 #1 0xb7a5d030 in osl_shutdownSocket () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #2 0xb6c64280 in osl::Socket::shutdown (this=0xb6c9e8d4, Direction=osl_Socket_DirReadWrite) at /data/opt/libreoffice/bootstrap/solver/340/unxlngi6.pro/inc/osl/socket.hxx:259 #3 0xb6c63ca6 in stoc_connector::SocketConnection::close (this=0xb6c9e8b8) at /data/opt/libreoffice/bootstrap/clone/ure/io/source/connector/ctr_socket.cxx:228 #4 0xb6c1bc7f in binaryurp::Bridge::terminate (this=0xb6c9d9b0) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:253 #5 0xb6c38ff9 in binaryurp::Reader::run (this=0xb63de008) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/reader.cxx:152 #6 0xb6c20b9a in osl::threadFunc (param=0xb63de008) at /data/opt/libreoffice/bootstrap/solver/340/unxlngi6.pro/inc/osl/thread.hxx:188 #7 0xb7a5e1b8 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #8 0xb7e25b05 in start_thread () from /lib/libpthread.so.0 #9 0xb7d52d5e in clone () from /lib/libc.so.6 Thread 3 (Thread 0xb6beeb70 (LWP 23310)): #0 0xffffe424 in __kernel_vsyscall () #1 0xb7e2a105 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0 #2 0xb7a5b390 in osl_waitCondition () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #3 0xb6c212ce in osl::Condition::wait (this=0xb6c9dc0c, pTimeout=0x0) at /data/opt/libreoffice/bootstrap/solver/340/unxlngi6.pro/inc/osl/conditn.hxx:84 #4 0xb6c3ea34 in binaryurp::Writer::run (this=0xb6c9db70) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/writer.cxx:160 #5 0xb6c20b9a in osl::threadFunc (param=0xb6c9db70) at /data/opt/libreoffice/bootstrap/solver/340/unxlngi6.pro/inc/osl/thread.hxx:188 #6 0xb7a5e1b8 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #7 0xb7e25b05 in start_thread () from /lib/libpthread.so.0 #8 0xb7d52d5e in clone () from /lib/libc.so.6 Thread 2 (Thread 0xb7920b70 (LWP 23298)): #0 0xffffe424 in __kernel_vsyscall () #1 0xb7e2a432 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0 #2 0xb7a7eb3c in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #3 0xb7e25b05 in start_thread () from /lib/libpthread.so.0 #4 0xb7d52d5e in clone () from /lib/libc.so.6 Thread 1 (Thread 0xb7c7e6c0 (LWP 23297)): #0 0xffffe424 in __kernel_vsyscall () #1 0xb7e2a105 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0 #2 0xb7a5b390 in osl_waitCondition () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_sal.so.3 #3 0xb7b44205 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #4 0xb7b413d6 in ?? () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #5 0xb7b41a37 in uno_threadpool_enter () from /opt/OOInstall/basis3.4/program/../ure-link/lib/libuno_cppu.so.3 #6 0xb6c1db2a in binaryurp::Bridge::makeCall (this=0xb6c9d9b0, oid=..., member=..., setter=false, inArguments=..., returnValue=0xbfffdd58, outArguments=0xbfffdd4c) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/bridge.cxx:572 #7 0xb6c3817c in binaryurp::Proxy::do_dispatch_throw (this=0x8118b88, member=0x80f8e48, returnValue=0xbfffe234, arguments=0xbfffdeb0, exception=0xbfffdf24) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:191 #8 0xb6c37bdb in binaryurp::Proxy::do_dispatch (this=0x8118b88, member=0x80f8e48, returnValue=0xbfffe234, arguments=0xbfffdeb0, exception=0xbfffdf24) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:117 #9 0xb6c37938 in binaryurp::(anonymous namespace)::proxy_dispatchInterface (pUnoI=0x8118b88, pMemberType=0x80f8e48, pReturn=0xbfffe234, pArgs=0xbfffdeb0, ppException=0xbfffdf24) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/proxy.cxx:70 #10 0xb6df6033 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #11 0xb6df665a in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #12 0xb6df7165 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #13 0xb6cc7d26 in ?? () from /data/opt/OOInstall/ure/lib/introspection.uno.so #14 0xb6ccaf26 in ?? () from /data/opt/OOInstall/ure/lib/introspection.uno.so #15 0xb6cfc4e2 in ?? () from /data/opt/OOInstall/ure/lib/invocation.uno.so #16 0xb6cfc917 in ?? () from /data/opt/OOInstall/ure/lib/invocation.uno.so #17 0xb6cfca3a in ?? () from /data/opt/OOInstall/ure/lib/invocation.uno.so #18 0xb7b61bf2 in pyuno::PyUNO_new_UNCHECKED(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::lang::XSingleServiceFactory> const&) () from /opt/OOInstall/basis3.4/program/pyuno.so #19 0xb7b61ce5 in pyuno::PyUNO_new(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::lang::XSingleServiceFactory> const&) () from /opt/OOInstall/basis3.4/program/pyuno.so #20 0xb7b5ba9d in pyuno::Runtime::any2PyObject(com::sun::star::uno::Any const&) const () from /opt/OOInstall/basis3.4/program/pyuno.so #21 0xb7b63899 in pyuno::PyUNO_callable_call(_object*, _object*, _object*) () from /opt/OOInstall/basis3.4/program/pyuno.so ... which occurs just before the main thread gets its answer back and we get the exception. That seems a bit enthusiastic of thread 4. #5 0xb6c38ff9 in binaryurp::Reader::run (this=0xb63de008) at /data/opt/libreoffice/bootstrap/clone/ure/binaryurp/source/reader.cxx:152 152 bridge_->terminate(); (gdb) l 147 OSL_LOG_PREFIX "caught UNO exception '%s'", 148 rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); 149 } catch (std::exception & e) { 150 OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); 151 } 152 bridge_->terminate(); 153 } 154 Do we -really- want to terminate the bridge after each 'run' call ? Surely we can re-use the socket. 238 void Bridge::terminate() { 239 rtl::Reference< Reader > r; 240 rtl::Reference< Writer > w; 241 Listeners ls; 242 { 243 osl::MutexGuard g(mutex_); 244 if (terminated_) { (gdb) 245 return; 246 } 247 std::swap(reader_, r); 248 std::swap(writer_, w); 249 ls.swap(listeners_); 250 terminated_ = true; 251 } 252 try { 253 connection_->close(); 254 } catch (css::io::IOException & e) { All looks most odd to me :-)
Ho hum - the reason the cnx is shutdown, is due to an earlier exception being thrown, from here: #4 0xb6da1165 in ?? () from /data/opt/OOInstall/ure/lib/libgcc3_uno.so #5 0xb6c4aea3 in stoc_inspect::ImplIntrospection::implInspect (this=0xb6cb4290, aToInspectObj=...) at /data/opt/libreoffice/bootstrap/clone/ure/stoc/source/inspect/introspection.cxx:2070 #6 0xb6c4a924 in stoc_inspect::ImplIntrospection::inspect (this=0xb6cb4290, aToInspectObj=...) at /data/opt/libreoffice/bootstrap/clone/ure/stoc/source/inspect/introspection.cxx:1955 #7 0xb6c9ca9a in stoc_inv::Invocation_Impl::setMaterial (this=0xb6bec89c, rMaterial=...) at /data/opt/libreoffice/bootstrap/clone/ure/stoc/source/invocation/invocation.cxx:426 #8 0xb6c9bc3a in stoc_inv::Invocation_Impl::Invocation_Impl (this=0xb6bec89c, rAdapted=..., rTC=..., rI=..., rCR=...) at /data/opt/libreoffice/bootstrap/clone/ure/stoc/source/invocation/invocation.cxx:284 #9 0xb6ca0622 in stoc_inv::InvocationService::createInstanceWithArguments (this=0xb70e37e8, rArguments=...) at /data/opt/libreoffice/bootstrap/clone/ure/stoc/source/invocation/invocation.cxx:1205 #10 0xb7b61bf2 in pyuno::PyUNO_new_UNCHECKED(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::lang::XSingleServiceFactory> const&) () from /opt/OOInstall/basis3.4/program/pyuno.so #11 0xb7b61ce5 in pyuno::PyUNO_new(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::lang::XSingleServiceFactory> const&) () from /opt/OOInstall/basis3.4/program/pyuno.so #12 0xb7b5ba9d in pyuno::Runtime::any2PyObject(com::sun::star::uno::Any const&) const () from /opt/OOInstall/basis3.4/program/pyuno.so #13 0xb7b63899 in pyuno::PyUNO_callable_call(_object*, _object*, _object*) () from /opt/OOInstall/basis3.4/program/pyuno.so #14 0xb7ec2b40 in PyObject_Call (func=0xb7c6f130, arg=0xb7c325cc, kw=0x0) at Objects/abstract.c:2522 #15 0xb7ede4d3 in do_call (f=0x80d1e3c, throwflag=0) at Python/ceval.c:4230 #16 call_function (f=0x80d1e3c, throwflag=0) at Python/ceval.c:4035 #17 PyEval_EvalFrameEx (f=0x80d1e3c, throwflag=0) at Python/ceval.c:2665 I guess something goes badly wrong in the introspection mechanics - as if by a miracle [etc.]
following the discussion at http://nabble.documentfoundation.org/python-XInvocation-snafu-td2961502.html I had a look at VclStringResourceLoader and it is broken beyond repair. With commit http://cgit.freedesktop.org/libreoffice/components/commit/?h=feature/gsoc2011_wizards&id=264c9ed93f3d338f6aee84310135569710705783 I removed the broken service and implemented a org.libreoffice.extensions.resource.ResourceStringIndexAccess service as a replacement. Here is a piece of Basic code that shows how to use it (inspired by http://opengrok.libreoffice.org/xref/components/wizards/com/sun/star/wizards/common/TerminateWizardException.java ): Sub Main dim xSM dim xContext dim xRSIA as Object dim aArgs(0) aArgs(0) = "dbw" xSM = GetProcessServiceManager() xContext = xSM.DefaultContext xRSIA = xSM.createInstanceWithArguments("org.libreoffice.resource.ResourceStringIndexAccess", aArgs) msgbox xRSIA.getByIndex(1006) end sub I commited the change to the feature branch gsoc2011_wizards as this change would break master because I have not yet changed the clients of VclStringResourceLoader to use ResourceStringIndexAccess instead.
Because in some places also StringLists are needed as resources, I had to change the API has to take care of that too. Here is an updated example: Sub Main dim xSM dim xContext dim xRessouceIndexAccess as Object dim xStringIndexAccess as Object dim xStringListIndexAcess as Object dim pv() as Object dim aArgs(0) aArgs(0) = "svt" xSM = GetProcessServiceManager() xResourceIndexAccess = xSM.createInstanceWithArguments( _ "org.libreoffice.resource.ResourceIndexAccess", _ aArgs) xStringListIndexAccess = xResourceIndexAccess.getByName("StringList") pv = xStringListIndexAccess.getByIndex(16633) msgbox pv(0).Name msgbox pv(0).Value xStringIndexAccess = xResourceIndexAccess.getByName("String") msgbox xStringIndexAccess.getByIndex(16390) end sub
closing as fixed on master
closing
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.