LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

latexmlc exits with error code 10, no error message

Open nschloe opened this issue 2 years ago • 13 comments

When running the file

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics{4a.eps}
\includegraphics{4b.eps}
\end{figure}

\end{document}

through

latexmlc --source=fail/main.tex 

I'm getting an error code 10 without any error message:

latexmlc (LaTeXML version 0.8.7)
processing started Wed Oct 18 12:36:04 2023
 /%   

Full example attached.

fail.zip

nschloe avatar Oct 18 '23 10:10 nschloe

I can't reproduce. I wonder if this may be an installation issue related to #1216 .

Did you successfully complete make test on that installation?

dginev avatar Oct 18 '23 14:10 dginev

Yeah, I'm guessing I somehow messed up my installation. Using Arch's sources, so I guess it's not that. The lack of an error message makes this hard.

nschloe avatar Oct 18 '23 14:10 nschloe

You could check if you can introspect more by using a perl script that keeps the reason for failure via an eval{} block, as in:

test_convert.pl

use strict;
use warnings;
use LaTeXML;
use Data::Dumper;

my $opts = LaTeXML::Common::Config->new(verbosity => 3, format=>'html5', destination=>'main.html');
my $converter = LaTeXML->get_converter($opts);
$converter->prepare_session($opts);
my $result;
eval {
  $result = $converter->convert('main.tex');
};

print("conversion died: ".$@."\n") if $@;
print Dumper($result) if $result;

and then perl test_convert.pl in the directory with the source.

Edit: The thing is, latexmlc is already designed to do that. So the silent mid-run failure can often be a sign of some irrecoverable crash in the C internals of some of the dependencies (often libxml2 or imagemagick, but possibly even perl itself)

dginev avatar Oct 18 '23 14:10 dginev

Thanks for the tip with the script. Unfortunately, it also just dies with error code 10 and no output.

nschloe avatar Oct 18 '23 15:10 nschloe

Unfortunate, but it makes it extra clear that the process termination happens outside of the Perl interpreter. If for any reason you hit an unexpected segfault in libxml2 or imagemagick, you would see something similar (though ideally also with a printed segmentation fault error). latexml's verbosity currently does not reach into those dependencies, so we have no existing way of making them easier to introspect on such a silent death. And again, it could even be perl itself dying silently, it's just rarer historically.

Separately, I wonder if this is the exact same cause as in #2059 , which we also haven't managed to reproduce/diagnose fully.

Could you also share the Arch installation details of latexml, libxml2 and imagemagick? And maybe the version lines of latexml -V, xmllint --version and convert --version.

dginev avatar Oct 18 '23 15:10 dginev

Alright, it remains mysterious then. I wouldn't want to take any more of your time. In my experience, these bugs somehow resolve themselves after a restart or some package updates. I'll report back if I find out anything more.

latexml -V
latexml (LaTeXML version 0.8.7)
xmllint --version
xmllint: using libxml version 21105-GITv2.11.5
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 HTTP DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Unicode Regexps Automata Schemas Schematron Modules Debug Zlib Lzma 
convert --version
Version: ImageMagick 7.1.1-20 Q16-HDRI x86_64 21621 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP(4.5) 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png raqm raw rsvg tiff webp wmf x xml zip zlib
Compiler: gcc (13.2)

nschloe avatar Oct 18 '23 16:10 nschloe

Odd... I had an old laptop laying around, so I installed a fresh Arch today - and saw the libxml and ImageMagick versions you report above. I installed latexml via yaourt -S perl-latexml and the examples above worked. Then also did a make test on a local git clone of the repository (with and without an installed texlive) which succeeded.

I also tried yaourt -S perl-latexml-git, which also succeeded on the example.

There were two non-standard steps I made, which likely isn't relevant, but mentioning just in case:

  1. Since I reused a /home partition on that laptop, I removed ~/perl5 before I started the installation steps, so that I rely on the perl dependencies through the package manager.
  2. I ran a usual package update via pacman -Syu, and installed yaourt to use the AUR packages.

So how to reproduce remains a mystery for now.

dginev avatar Oct 23 '23 03:10 dginev

@nschloe I am still uneasy about not knowing the circumstances for the crash here. Could I also ask you for the outputs of:

uname -p and perl -v on the machine with the failure?

perl-related differences and issues with 32-bit libxml are my next best guesses.

dginev avatar Oct 25 '23 14:10 dginev

uname -p
unknown
perl -v
This is perl 5, version 38, subversion 0 (v5.38.0) built for x86_64-linux-thread-multi

Copyright 1987-2023, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the

nschloe avatar Oct 25 '23 14:10 nschloe

I'm having the same issue so I'm curious if @nschloe found a solution.

Otherwise, is there anything you'd like me to check?

This occurs both when building from source, and in the AUR package.

latexml 0.8.8

Linux 6.9.5-arch1-1 x86_64 GNU/Linux

This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi

libxml2 - 2.13.1-1 perl-alien-libxml2 - 0.19-2 perl-xml-libxml - 2.0209-1

make test passes with no problems.

As a workaround I am running this in a docker container on debian bookworm. Works well there.

orbita2d avatar Jun 21 '24 22:06 orbita2d