You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2012/02/29 19:57:14 UTC

DO NOT REPLY [Bug 96152] Java Uno wrapper locks up when connection disappears

https://issues.apache.org/ooo/show_bug.cgi?id=96152

Jason Powers <jp...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jpower2@gmail.com

--- Comment #5 from Jason Powers <jp...@gmail.com> 2012-02-29 18:57:14 UTC ---
I've run into this as well, and our load tester seems to be able to reproduce
it fairly easily. Will update more details on that once I have them.

For my code we're using the 'client' inside of a server process. This makes
restarting the client a bit less desirable.

It seems to happen when attempting to open a new connection or an instance of
OpenOffice that has locked up or is otherwise in a bad state. It seems to just
sit on a wait hoping to be notified by another thread. It just never happens.

I've updated a copy of writeRequest to look like this:
// @see IProtocol#writeRequest
    public boolean writeRequest(
        String oid, TypeDescription type, String function, ThreadId tid,
        Object[] arguments)
        throws IOException
    {
        if (oid.equals(PROPERTIES_OID)) {
            throw new IllegalArgumentException("illegal OID " + oid);
        }
        synchronized (monitor) {
            while (!initialized && state != STATE_TERMINATED) {
                try {
                    monitor.wait();
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new RuntimeException(e.toString());
                }
            }
            if (state == STATE_TERMINATED) {
                throw new DisposedException();
            }
            return writeRequest(false, oid, type, function, tid, arguments);
        }
    }

Adding in the state != TERMINATED. This appears to have fixed the problem so
far, but I think it still needs a timeout on the monitor.wait() call so it
doesn't sit there indefinitely waiting.

When I detect a stuck instance my code kills the OpenOffice Instance, and also
calls close on the bridge object associated with this. That code flips the
state to STATE_TERMINATED and notifies on monitor. I'm not sure if that will
work for all users, so a timeout would probably be needed here as well.

-- 
Configure bugmail: https://issues.apache.org/ooo/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.