Comment 3 for bug 787539

Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

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 :-)