otfried / ipe

The Ipe extensible drawing editor
http://ipe.otfried.org
125 stars 9 forks source link

Occasional segfault when using luatex #504

Closed Mortal closed 1 month ago

Mortal commented 1 month ago

I have a large presentation file that uses \usepackage{fontspec} and \setmainfont to use a corporate design font in my Ipe slideshow, so I'm using luatex as the TeX engine. This leads to frequent short-lived modals showing that Ipe is waiting on TeX - which I don't see otherwise as I'm normally using the default engine. Occasionally Ipe will crash, and today I managed to catch a crash while running Ipe in gdb. I'm not sure but I think all crashes have been while Ipe was showing/about to show the luatex wait dialog, and at least this backtrace is also inside the ipeui_wait function.

I haven't been able to reproduce the crash reliably, unfortunately, but I've experienced it on two separate systems (both running GNOME+wayland on Arch Linux).

I've compiled Ipe 7.2.28 from source using the AUR package in Arch Linux.

$ gdb -ex r --args ipe
GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ipe...
Reading symbols from /usr/lib/debug/usr/bin/ipe.debug...
Starting program: /usr/bin/ipe dynflood-20240522.ipe
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff20006c0 (LWP 2449)]
[New Thread 0x7fffebe006c0 (LWP 2450)]
[New Thread 0x7fffeb4006c0 (LWP 2451)]
[New Thread 0x7fffeaa006c0 (LWP 2452)]
[New Thread 0x7fffea0006c0 (LWP 2453)]
[New Thread 0x7fffe96006c0 (LWP 2454)]
[New Thread 0x7fffe8c006c0 (LWP 2455)]
[New Thread 0x7fffe3e006c0 (LWP 2456)]
[New Thread 0x7fffe34006c0 (LWP 2457)]
[New Thread 0x7fffe1e006c0 (LWP 2459)]
[New Thread 0x7fffe14006c0 (LWP 2460)]
[New Thread 0x7fffcac006c0 (LWP 2488)]
[Detaching after vfork from child process 2489]
[New Thread 0x7fffbfe006c0 (LWP 2492)]
[New Thread 0x7fffafc006c0 (LWP 2493)]
[New Thread 0x7fffaf2006c0 (LWP 2494)]
[New Thread 0x7fffae8006c0 (LWP 2495)]
[Thread 0x7fffcac006c0 (LWP 2488) exited]
[New Thread 0x7fffcac006c0 (LWP 2496)]
[New Thread 0x7fffade006c0 (LWP 2497)]
[New Thread 0x7fffad4006c0 (LWP 2498)]
[New Thread 0x7fffaca006c0 (LWP 2499)]
[Thread 0x7fffeaa006c0 (LWP 2452) exited]
[Thread 0x7fffad4006c0 (LWP 2498) exited]
[Thread 0x7fffaca006c0 (LWP 2499) exited]
[Thread 0x7fffade006c0 (LWP 2497) exited]
[Thread 0x7fffcac006c0 (LWP 2496) exited]
[Thread 0x7fffae8006c0 (LWP 2495) exited]
[Thread 0x7fffafc006c0 (LWP 2493) exited]
[Thread 0x7fffaf2006c0 (LWP 2494) exited]
[Thread 0x7fffbfe006c0 (LWP 2492) exited]
[New Thread 0x7fffaf2006c0 (LWP 2570)]
[New Thread 0x7fffae8006c0 (LWP 2571)]
[New Thread 0x7fffbfe006c0 (LWP 2572)]
[New Thread 0x7fffaca006c0 (LWP 2573)]
[New Thread 0x7fffcac006c0 (LWP 2574)]
[New Thread 0x7fffafc006c0 (LWP 2575)]
[New Thread 0x7fffade006c0 (LWP 2576)]
[New Thread 0x7fffad4006c0 (LWP 2577)]
[Thread 0x7fffad4006c0 (LWP 2577) exited]
[Thread 0x7fffade006c0 (LWP 2576) exited]
[Thread 0x7fffafc006c0 (LWP 2575) exited]
[Thread 0x7fffcac006c0 (LWP 2574) exited]
[Thread 0x7fffaca006c0 (LWP 2573) exited]
[Thread 0x7fffbfe006c0 (LWP 2572) exited]
[Thread 0x7fffae8006c0 (LWP 2571) exited]
[Thread 0x7fffaf2006c0 (LWP 2570) exited]
[New Thread 0x7fffcac006c0 (LWP 3282)]
[New Thread 0x7fffad4006c0 (LWP 3283)]
[New Thread 0x7fffade006c0 (LWP 3284)]
[New Thread 0x7fffbfe006c0 (LWP 3285)]
[New Thread 0x7fffafc006c0 (LWP 3286)]
[New Thread 0x7fffaf2006c0 (LWP 3287)]
[New Thread 0x7fffae8006c0 (LWP 3288)]
[New Thread 0x7fffaca006c0 (LWP 3289)]
[New Thread 0x7fffa7e006c0 (LWP 3290)]
[Detaching after vfork from child process 3291]
[Thread 0x7fffa7e006c0 (LWP 3290) exited]
[New Thread 0x7fffa7e006c0 (LWP 3305)]
[Detaching after vfork from child process 3306]
[Thread 0x7fffa7e006c0 (LWP 3305) exited]
[New Thread 0x7fffa7e006c0 (LWP 3310)]
[Detaching after vfork from child process 3311]
QBasicTimer::stop: Failed. Possibly trying to stop from a different thread
QBasicTimer::stop: Failed. Possibly trying to stop from a different thread
QItemSelectionModel: Selecting when no model has been set will result in a no-op.
QBasicTimer::stop: Failed. Possibly trying to stop from a different thread
QBasicTimer::stop: Failed. Possibly trying to stop from a different thread
QBasicTimer::stop: Failed. Possibly trying to stop from a different thread

Thread 1 "ipe" received signal SIGSEGV, Segmentation fault.
0x00007ffff674c78c in QMetaObject::cast(QObject const*) const () from /usr/lib/libQt6Core.so.6
(gdb) bt
#0  0x00007ffff674c78c in QMetaObject::cast(QObject const*) const () at /usr/lib/libQt6Core.so.6
#1  0x00007ffff6d025b9 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#2  0x00007ffff673fe18 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#3  0x00007ffff68b7988 in QTimerInfoList::activateTimers() () at /usr/lib/libQt6Core.so.6
#4  0x00007ffff6995801 in ??? () at /usr/lib/libQt6Core.so.6
#5  0x00007ffff59d0a89 in ??? () at /usr/lib/libglib-2.0.so.0
#6  0x00007ffff5a329b7 in ??? () at /usr/lib/libglib-2.0.so.0
#7  0x00007ffff59cff95 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#8  0x00007ffff6993389 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#9  0x00007ffff6748350 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#10 0x00007ffff6f5b1ec in QDialog::exec() () at /usr/lib/libQt6Widgets.so.6
#11 0x00007ffff7e6fe55 in ipeui_wait (L=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.28/src/ipeui/ipeui_qt.cpp:699
#12 0x00007ffff7e256db in ??? () at /usr/lib/liblua.so.5.4
#13 0x00007ffff7e34794 in ??? () at /usr/lib/liblua.so.5.4
#14 0x00007ffff7e261ad in ??? () at /usr/lib/liblua.so.5.4
#15 0x00007ffff7e20574 in ??? () at /usr/lib/liblua.so.5.4
#16 0x00007ffff7e3ff34 in ??? () at /usr/lib/liblua.so.5.4
#17 0x00007ffff7e262ce in lua_pcallk () at /usr/lib/liblua.so.5.4
#18 0x00007ffff7e3e15a in ??? () at /usr/lib/liblua.so.5.4
#19 0x00007ffff7e256db in ??? () at /usr/lib/liblua.so.5.4
#20 0x00007ffff7e34794 in ??? () at /usr/lib/liblua.so.5.4
#21 0x00007ffff7e2600f in lua_callk () at /usr/lib/liblua.so.5.4
#22 0x0000555555576965 in ipelua::luacall (nresults=0, nargs=2, L=<optimized out>) at ../ipelua/ipelua.h:134
#23 AppUiBase::luaAction (name=..., this=0x5555556b4538) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/appui.cpp:609
#24 AppUi::action (this=0x5555556b4510, name=...) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/appui_qt.cpp:965
#25 0x0000555555579936 in AppUi::qAction (name=<optimized out>, this=0x5555556b4510) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/appui_qt.cpp:953
#26 AppUi::qt_static_metacall (_o=0x5555556b4510, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/moc_appui_qt.cpp:241
#27 0x00007ffff679b88f in ??? () at /usr/lib/libQt6Core.so.6
#28 0x00007ffff679e0ec in QSignalMapper::mappedString(QString const&) () at /usr/lib/libQt6Core.so.6
#29 0x00007ffff679cf0c in ??? () at /usr/lib/libQt6Core.so.6
#30 0x00007ffff679b88f in ??? () at /usr/lib/libQt6Core.so.6
#31 0x00007ffff7901eda in QAction::activate(QAction::ActionEvent) () at /usr/lib/libQt6Gui.so.6
#32 0x00007ffff7904212 in QAction::event(QEvent*) () at /usr/lib/libQt6Gui.so.6
#33 0x00007ffff6cfc44d in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#34 0x00007ffff673fe18 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#35 0x00007ffff791a8a5 in QShortcutMap::dispatchEvent(QKeyEvent*) () at /usr/lib/libQt6Gui.so.6
#36 0x00007ffff75e04f6 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () at /usr/lib/libQt6Gui.so.6
#37 0x00007ffff75779e2 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /usr/lib/libQt6Gui.so.6
#38 0x00007ffff75e8dcc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Gui.so.6
#39 0x00007ffff79e1294 in ??? () at /usr/lib/libQt6Gui.so.6
#40 0x00007ffff59d0a89 in ??? () at /usr/lib/libglib-2.0.so.0
#41 0x00007ffff5a329b7 in ??? () at /usr/lib/libglib-2.0.so.0
#42 0x00007ffff59cff95 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#43 0x00007ffff6993389 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#44 0x00007ffff6748350 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#45 0x00007ffff6743c1d in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6
#46 0x000055555556b09e in mainloop (L=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/main_qt.cpp:104
#47 0x00007ffff7e256db in ??? () at /usr/lib/liblua.so.5.4
#48 0x00007ffff7e34794 in ??? () at /usr/lib/liblua.so.5.4
#49 0x00007ffff7e2600f in lua_callk () at /usr/lib/liblua.so.5.4
#50 0x00007ffff7e46788 in ??? () at /usr/lib/liblua.so.5.4
#51 0x00007ffff7e256db in ??? () at /usr/lib/liblua.so.5.4
#52 0x00007ffff7e34794 in ??? () at /usr/lib/liblua.so.5.4
#53 0x00007ffff7e261ad in ??? () at /usr/lib/liblua.so.5.4
#54 0x00007ffff7e20574 in ??? () at /usr/lib/liblua.so.5.4
#55 0x00007ffff7e3ff34 in ??? () at /usr/lib/liblua.so.5.4
#56 0x00007ffff7e262ce in lua_pcallk () at /usr/lib/liblua.so.5.4
#57 0x000055555556655d in lua_run_ipe (fn=0x55555556b090 <mainloop(lua_State*)>, L=0x5555555be898) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/main_common.i:140
#58 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.28/src/ipe/main_qt.cpp:128
otfried commented 1 month ago

A quick note first: You can avoid the crash by doing this: https://github.com/otfried/ipe/issues/495#issuecomment-1962861835

Many thanks for the backtrace, I may be able to figure out what is happening from that. It seems that a change in Qt made what Ipe is doing illegal.

otfried commented 1 month ago

I suspect this is actually the same issue as in #495, so let me keep only that one open.
Let's hope that the changes I just make eliminate the problem!