question about "Binary URP bridge disposed during call" error

Hi everybody,

We utilize LibreOffice SDK 5.0 64 C++ to print documents with LibreOffice
5.1.0.3 . During batch testing, I print a odt file over and over again. The
problem is the program throw exception "Binary URP bridge disposed during
call" from time to time. This exception happens on *Windows 10* and doesn't
happen on Windows Server 2012 or Windows Server 2012 R2.

By the way, the exception also happens with other files, and it happens on
32-bit version too.

The basic printing code is:

m_xDocument = m_xDesktop->loadComponentFromURL(
                                                                   Url,
                                                  OUString(
RTL_CONSTASCII_USTRINGPARAM("_blank") ),
                                                 0,
                                                 loadProperties );

try{
    Reference< XPrintable > xprintable( m_xDocument, UNO_QUERY);
    xprintable->print( m_xPrintProperties );
    WaitForPrintComplete();//xPrintable->getPrinter() and check printer
property
}
catch ( Exception& exception )
{
    throw new MyExceptionClass(1, exception.Message.getStr());//"Binary URP
bridge disposed during call"
}

if (m_xDocument != NULL) { m_xDocument->dispose();}
         
Thanks!

Shawn

That exception typically indicates that LO's soffice.bin process crashed. See <https://wiki.documentfoundation.org/QA/BugReport/Debug_Information#Windows:_How_to_get_a_backtrace> how to get a backtrace for a crashing soffice.bin; maybe that could give us some clue why it crashes.

Hm, that's rather odd.

For one, this crash is during "clean" termination of the soffice.bin process, i.e., at a time when your external code should no longer communicate with the soffice.bin process anyway. (Or is your external code designed in a way that it might call com.sun.star.frame.XDesktop.terminate while some printing activity is still in progress?)

For another, I see no way how com::sun::star::ucb::UniversalContentBroker::create could throw an exception there during shutdown. It should already have been called during initialization, from Desktop::Main -> Desktop::RegisterServices -> configureUcb, and if that had already failed with an exception, that would have caused a call to FatalError, which immediately terminates the process via _exit.

Are you sure that that crash dump correlates to a "Binary URP bridge disposed during call" exception in your client, or could it be from a "harmless" crash of an soffice.bin instance after your client code had already disconnected (so might normally go rather unnoticed, except for leaving behind a crash dump)?

Hi Stephan,

I redo the batch testing and you are right: my program killed soffice.bin after waiting 2 minutes and can't open
a file for printing through "m_xDesktop->loadComponentFromURL()". And the function then throw a "Binary URP bridge disposed during call" exception. (And no LibreOffice crash happen for my new printing program. )

This issue happened randomly and most of the time the same file can be opened correctly.

Basically, the testing case is to start soffice.bin and print 10 files then close it. The testing case will be repeated thousands time.
If I restart soffice.bin every time a printing job finished, "loadComponentFromURL()" always return quickly.

I am wondering why "m_xDesktop->loadComponentFromURL()" sometimes get stuck and how to generate debugging information when it get stuck?
  
Best Regards,

Shawn

Debugging a "got stuck" situation is relatively easy: attach a debugger to the stuck process, generate backtraces for all its threads, and analyze from there.