Files
odfstudio/toolkit
Michael Weghorn 9d85a49f7a JunitTest_toolkit_complex: Dispose grid control before its model etc.
In recent weeks, JunitTest_toolkit_complex was seen occasionally
failing in CI, see e.g. last ESC minutes [1]:

> + tests that failed more than twice in last seven days
>   [...]
>   18 JunitTest_toolkit_complex                gerrit_linux_clang_dbgutil

It's unclear why the failure started to happen recently
and it doesn't happen reliably.

I was unable to reproduce the problem locally, even when running

    make JunitTest_toolkit_complex

in a loop.

From a sample Jenkins failure log [2], what *might* be happening
is that the model etc. get disposed before the grid control in
the Java test code.

From the console log:

    There were 6 failures:
    1) testView(complex.toolkit.GridControl)
    com.sun.star.lang.DisposedException
            at com.sun.star.lib.uno.environments.remote.JobQueue.removeJob(JobQueue.java:199)
            at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:309)
            at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:279)
            at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:83)
            at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:619)
            at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:145)
            at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:129)
            at jdk.proxy2/jdk.proxy2.$Proxy21.dispose(Unknown Source)
            at complex.toolkit.GridControl.impl_dispose(GridControl.java:79)
            at complex.toolkit.GridControl.cleanupTestCase(GridControl.java:615)
            ... 35 trimmed
    Caused by: java.io.EOFException
            at java.base/java.io.DataInputStream.readInt(DataInputStream.java:386)
            at com.sun.star.lib.uno.protocols.urp.urp.readBlock(urp.java:364)
            at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:96)
            at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:92)
    2) testSortableDataModel(complex.toolkit.GridControl)
    com.sun.star.lang.DisposedException: java_remote_bridge com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge@210366b4 is disposed
            at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.checkDisposed(java_remote_bridge.java:689)
            at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:603)
            at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:145)
            at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:129)
            at jdk.proxy2/jdk.proxy2.$Proxy12.getServiceManager(Unknown Source)
            at complex.toolkit.GridControl.createInstance(GridControl.java:654)
            at complex.toolkit.GridControl.impl_recreateGridModel(GridControl.java:91)
            at complex.toolkit.GridControl.testSortableDataModel(GridControl.java:354)

C++ backtrace:

    Thread 1 (Thread 0x7f0aff59adc0 (LWP 2939300)):
    #0  0x00007f0b0708d4bc in __pthread_kill_implementation () at /lib64/libc.so.6
    #1  0x00007f0b0703fbb6 in raise () at /lib64/libc.so.6
    #2  0x00007f0b07029873 in abort () at /lib64/libc.so.6
    #3  0x00007f0b0786db51 in (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libuno_sal.so.3
    #4  0x00007f0b0786d680 in (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libuno_sal.so.3
    #5  0x00007f0b0703fc60 in <signal handler called> () at /lib64/libc.so.6
    #6  0x00007f0b0708d4bc in __pthread_kill_implementation () at /lib64/libc.so.6
    #7  0x00007f0b0703fbb6 in raise () at /lib64/libc.so.6
    #8  0x00007f0b07029873 in abort () at /lib64/libc.so.6
    #9  0x00007f0b0702979b in _nl_load_domain.cold () at /lib64/libc.so.6
    #10 0x00007f0b070388f6 in  () at /lib64/libc.so.6
    #11 0x00007f0aff09e392 in com::sun::star::uno::Reference<com::sun::star::awt::grid::XMutableGridDataModel>::operator->() const () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libtklo.so
    #12 0x00007f0aff0961a1 in (anonymous namespace)::SortableGridDataModel::getRowCount() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libtklo.so
    #13 0x00007f0aff1dae5c in svt::table::UnoControlTableModel::getRowCount() const () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libtklo.so
    #14 0x00007f0aff1312b5 in svt::table::TableControl_Impl::doPaintContent(OutputDevice&, tools::Rectangle const&) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libtklo.so
    #15 0x00007f0aff149fc9 in svt::table::TableDataWindow::Paint(OutputDevice&, tools::Rectangle const&) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libtklo.so
    #16 0x00007f0afb41f321 in PaintHelper::DoPaint(vcl::Region const*) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #17 0x00007f0afb42074f in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #18 0x00007f0afb41ff57 in PaintHelper::~PaintHelper() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #19 0x00007f0afb4207d6 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #20 0x00007f0afb41ff57 in PaintHelper::~PaintHelper() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #21 0x00007f0afb4207d6 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #22 0x00007f0afb41ff57 in PaintHelper::~PaintHelper() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #23 0x00007f0afb4207d6 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #24 0x00007f0afb420c7e in vcl::Window::ImplCallOverlapPaint() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #25 0x00007f0afb420e34 in vcl::Window::ImplHandlePaintHdl(Timer*) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #26 0x00007f0afb420cbd in vcl::Window::LinkStubImplHandlePaintHdl(void*, Timer*) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #27 0x00007f0afbe37178 in Link<Timer*, void>::Call(Timer*) const () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #28 0x00007f0afbe36fcc in Timer::Invoke() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #29 0x00007f0afbdd92f9 in Scheduler::CallbackTaskScheduling() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #30 0x00007f0afc32ee86 in SalTimer::CallCallback() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #31 0x00007f0afc32ce9e in SvpSalInstance::CheckTimeout(bool) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #32 0x00007f0afc32e07d in SvpSalInstance::ImplYield(bool, bool) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #33 0x00007f0afc32e678 in SvpSalInstance::DoYield(bool, bool) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #34 0x00007f0afbe08bfc in InnerYield(bool, bool) () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #35 0x00007f0afbe083cb in Application::Yield() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #36 0x00007f0afbe08167 in Application::Execute() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #37 0x00007f0b0744e27a in desktop::Desktop::Main() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libsofficeapp.so
    #38 0x00007f0afbe33c83 in ImplSVMainRun() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #39 0x00007f0afbd2ff31 in SalInstance::SVMainRun() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #40 0x00007f0afbe33082 in ImplSVMain() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #41 0x00007f0afbe34ee9 in SVMain() () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libvcllo.so
    #42 0x00007f0b074d143c in soffice_main () at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/instdir/program/libsofficeapp.so
    #43 0x000055da4f9609bd in sal_main () at desktop/source/app/main.c:51
            ret = 8
    #44 0x000055da4f960997 in main (argc=8, argv=0x7ffe8beae9c8) at desktop/source/app/main.c:49
            ret = 538976288

This looks like event processing might have been triggered that
triggers the (re)paint of the TableDataWindow/TableControl_Impl
(frames #15 and #14), but then dereferencing the UnoControlTableModel's
data model in frame #11 fails, maybe because the data model has already
been disposed earlier?

Dispose the grid control at the end of the testView() Java test that is
the one that creates it and the only one using it, so that happens
before the model and data model etc. get disposed in impl_dispose() that gets
called from cleanupTestCase().
That is to prevent that a repaint is still attempted.
(When the TableControl is disposed, it's model is unset,
so svt::table::TableControl_Impl::doPaintContent (frame #14
in the backtrace) will return early, before trying to call
svt::table::UnoControlTableModel::getRowCount that is seen
in frame #13 of the above backtrace.)

Note: The above backtrace does not yet include the commits
refactoring TableControl and TableControl_Impl like

    commit 39749ff5b4
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Sep 18 15:30:10 2026 +0200

        toolkit: Merge TableControl into TableControl_Impl

and

    commit b580576a4d
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Sep 18 15:44:17 2026 +0200

        toolkit: Rename TableControl_Impl to TableControl

and

    commit e4f1a48967
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Sep 18 15:48:54 2026 +0200

        toolkit: Rename TableControl header/source to match new class name

, so the naming and exact code differs slightly with current master,
but as far as I can tell, that otherwise shouldn't have any effect on
the observed behavior.

This is an attempt to address the JunitTest_toolkit_complex failures
mentioned above, without being able to actually verify that locally
(as the failure could not be reproduced locally either).

[1] https://lists.freedesktop.org/archives/libreoffice/2026-September/094885.html
[2] https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/212155/console

Change-Id: If1a5411c92dfdfb49a34b31f4e44ac47d409772c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211231
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-09-20 22:25:05 +02:00
..
…
…

Abstract Windowing Toolkit

"Abstract" windowing thing. UNO implementations of windowing stuff so that it can be used from Basic or Java. But also stuff that has no connection to Basic or Java.

Notes

The "awt" here has no relation to the Java AWT, as far as I know. It might be inspired by it API-wise, perhaps. (If you know differently, feel free to improve this README.md file.)

Also note that toolkit/ is itself not really a toolkit, it is at root a reasonably simple wrapper of vcl/. If you came here looking for a toolkit, please look at vcl/ instead.