ipe icon indicating copy to clipboard operation
ipe copied to clipboard

Random crashes when compiling LaTeX for presentations

Open neuroshock1 opened this issue 1 year ago • 13 comments

I'm using Ipe on Fedora Linux 38 (Workstation), with Gnome 44.9.

I use Ipe all the time to create presentations, using the presentation style sheets, and my presentations often have 30 or more individual slides. I have the setting File>Automatically run Latex switched on, so when adding text boxes or even just saving, Ipe automatically compiles all the Latex.

About one out of every ~50 Latex compiles, meaning every five or ten minutes, Ipe will suddenly crash during a compile, with a segmentation fault. This has me so paranoid that I'm saving my file after every individual step, just in case Ipe crashes, so that I don't lose my work.

I couldn't find any other examples of this particular issue in the Ipe bug tracker.

Also, the stochastic behavior of this problem makes it inherently difficult to reproduce on demand.

I'd like to provide you with a core dump or some other kind of debug file, but I'm not sure which or how. If you can let me know what would be most informative, and how to capture it, I'd be happy to attach it to this bug report. Thanks so much.

neuroshock1 avatar Feb 25 '24 04:02 neuroshock1

Can you try adding prefs.freeze_in_latex = true to your preferences and see if this removes the crashes?

We had a race condition during latex runs that could cause this crash, and apparently it is not completely solved, see #359.

You need to give some more details, though. Are you on Windows, Linux, MacOS?

otfried avatar Feb 25 '24 08:02 otfried

Thanks very much! I'm using Fedora Linux 38 (Workstation), with Gnome 44.9. I'll try adding prefs.freeze_in_latex = true to my prefs.lua and follow-up after some testing.

neuroshock1 avatar Feb 25 '24 15:02 neuroshock1

The problem has indeed disappeared. Thanks! I'm rather curious why this prefs.freeze_in_latex = true setting isn't the default, then. What's the advantage of the alternative?

neuroshock1 avatar Feb 25 '24 18:02 neuroshock1

With this change, Ipe completely freezes while Latex is running. It can no longer respond to any user interaction (like minimizing the window), which can be somewhat disturbing during a slow latex run (xetex users are particularly affected, as xetex is much slower).

But it's a price worth paying for not having Ipe crash on you. The problem has only come up again recently, and I think only on some Linux distributions. At some point I have to investigate again.

otfried avatar Feb 25 '24 18:02 otfried

I see. May I then suggest making prefs.freeze_in_latex adjustable in the File menu, as a new item called something like "Run Latex in the background", immediately underneath the item "Automatically run Latex"? Maybe have it switched off by default (so that prefs.freeze_in_latex is "true"), but then people who have a lot of Latex to process can manually switch it on (thereby turning prefs.freeze_in_latex to "false")?

neuroshock1 avatar Feb 25 '24 21:02 neuroshock1

The problem has only come up again recently, and I think only on some Linux distributions.

I had an Ipe crash today during a latex compiling. I am using Manjaro Linux.

GoBigorGoHome avatar Feb 28 '24 11:02 GoBigorGoHome

I had an Ipe crash today during a latex compiling. I am using Manjaro Linux.

And you don't have prefs.freeze_in_latex set?

otfried avatar Feb 28 '24 11:02 otfried

No. I don't have anything new to add for this issue. Just want to add an evidence for the "recently" and "Linux" part of your reasoning.

GoBigorGoHome avatar Feb 28 '24 11:02 GoBigorGoHome

I am still seeing crashes on ipe v.7.2.30.

Here is the backtrace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000071cf36ebbd93 in ipe::Text::setXForm (this=0x5763e422a980, xform=0x71cee8005d00) at /usr/src/debug/ipe/ipe-7.2.30/src/ipelib/ipetext.cpp:586
586	 if (iXForm && --iXForm->iRefCount == 0)
[Current thread is 1 (Thread 0x71cf31c0f500 (LWP 12086))]
(gdb) bt
#0  0x000071cf36ebbd93 in ipe::Text::setXForm (this=0x5763e422a980, xform=0x71cee8005d00) at /usr/src/debug/ipe/ipe-7.2.30/src/ipelib/ipetext.cpp:586
#1  0x000071cf36ef1573 in ipe::Latex::updateTextObjects (this=this@entry=0x71cee80209f0) at /usr/src/debug/ipe/ipe-7.2.30/src/ipelib/ipelatex.cpp:498
#2  0x000071cf36ef232a in ipe::Document::completeLatexRun (this=0x5763e2367de0, converter=converter@entry=0x71cee80209f0) at /usr/src/debug/ipe/ipe-7.2.30/src/ipelib/ipedoc.cpp:691
#3  0x000071cf36f27a5c in document_completeLatexRun (L=0x5763e1fdda38) at /usr/src/debug/ipe/ipe-7.2.30/src/ipelua/ipelib.cpp:353
#4  0x000071cf36e206db in ?? () from /usr/lib/liblua.so.5.4
#5  0x000071cf36e2f794 in ?? () from /usr/lib/liblua.so.5.4
#6  0x000071cf36e2100f in lua_callk () from /usr/lib/liblua.so.5.4
#7  0x000071cf3674bcc6 in QWidget::event(QEvent*) () from /usr/lib/libQt6Widgets.so.6
#8  0x000071cf366fc55c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#9  0x000071cf36701a01 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#10 0x000071cf35744e38 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#11 0x000071cf366f3e6d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/libQt6Widgets.so.6
#12 0x000071cf36762072 in ?? () from /usr/lib/libQt6Widgets.so.6
#13 0x000071cf367636b0 in ?? () from /usr/lib/libQt6Widgets.so.6
#14 0x000071cf366fc55c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#15 0x000071cf35744e38 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#16 0x000071cf35d76cf0 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt6Gui.so.6
#17 0x000071cf35de5b44 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt6Gui.so.6
#18 0x000071cf361f9594 in ?? () from /usr/lib/libQt6Gui.so.6
#19 0x000071cf349d0a89 in ?? () from /usr/lib/libglib-2.0.so.0
#20 0x000071cf34a329b7 in ?? () from /usr/lib/libglib-2.0.so.0
#21 0x000071cf349cff95 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#22 0x000071cf359a28dd in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt6Core.so.6
#23 0x000071cf3574f10e in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt6Core.so.6
#24 0x000071cf3574945d in QCoreApplication::exec() () from /usr/lib/libQt6Core.so.6
#25 0x00005763ce7b0a2e in mainloop (L=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.30/src/ipe/main_qt.cpp:104
#26 0x000071cf36e206db in ?? () from /usr/lib/liblua.so.5.4
#27 0x000071cf36e2f794 in ?? () from /usr/lib/liblua.so.5.4
#28 0x000071cf36e2100f in lua_callk () from /usr/lib/liblua.so.5.4
#29 0x000071cf36e41788 in ?? () from /usr/lib/liblua.so.5.4
#30 0x000071cf36e206db in ?? () from /usr/lib/liblua.so.5.4
#31 0x000071cf36e2f794 in ?? () from /usr/lib/liblua.so.5.4
#32 0x000071cf36e211ad in ?? () from /usr/lib/liblua.so.5.4
#33 0x000071cf36e1b574 in ?? () from /usr/lib/liblua.so.5.4
#34 0x000071cf36e3af34 in ?? () from /usr/lib/liblua.so.5.4
#35 0x000071cf36e212ce in lua_pcallk () from /usr/lib/liblua.so.5.4
#36 0x00005763ce7aa768 in lua_run_ipe (fn=0x5763ce7b0a20 <mainloop(lua_State*)>, L=0x5763e1fdda38) at /usr/src/debug/ipe/ipe-7.2.30/src/ipe/main_common.i:140
#37 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/ipe/ipe-7.2.30/src/ipe/main_qt.cpp:128

In particular, the iXForm pointer in ipe::Text::setXForm seems to be corrupted:

(gdb) print iXForm
$1 = (ipe::Text::XForm *) 0xa0

I hope this helps.

Steven-- avatar Jun 15 '24 13:06 Steven--

Can you include the contents of Help -> Show libraries? What operating system are you using?

otfried avatar Jun 15 '24 18:06 otfried

Sure:

Ipe relies on the following fine pieces of software:

 * Pdftex, Xetex, or Luatex
 * Lua 5.4 (822 kB used)
 * The font rendering library Freetype 2.13.2 / 2.13.2
 * The rendering library Cairo 1.18.0 / 1.18.0
 * The clothoid spline library libspiro 1.3
 * The GNU scientific library gsl 2.8 / 2.8
 * The GUI toolkit Qt 6.7.1 / 6.7.1
 * The compression library zlib 1.3.1

I'm using arch linux.

Steven-- avatar Jun 15 '24 18:06 Steven--

I've been having the same issue here for some months. I've added the prefs.freeze_in_latex = true in a costumization.lua file in /home/user/.ipe/ipelets/ folder as recommended by the program itself and it seem to have solved the crashes. Haven't crashed once since. The last crash was followed by this message in the terminal: QObject::killTimer(): Error: timer id -1546188227 is not valid for object 0x60850a52a220 (QTimer, ), timer has not been killed Segmentation fault (core dumped) I'm using Arch Linux with XFCE and Ipe 7.2.30.

gabriel-torreao avatar Jul 01 '24 01:07 gabriel-torreao