New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latexmlc segmentation fault. #764

Closed
kohlhase opened this Issue Jun 14, 2016 · 10 comments

Comments

Projects
None yet
3 participants
@kohlhase
Contributor

kohlhase commented Jun 14, 2016

I want to use LaTeXML to generate publication pages. You can see the current state of my efforts at http://github.com/KWARC/bibs I have a couple of problems here, of which the segmentation fault is just the most worrying.

In the repository I have four large bibliography files and the plan for generating publication files is

  1. generate XML versions of all of these files via LaTeXML
  2. generate a LaTeX file with \nocites for all the relevant publications by an XSLT stylesheet
  3. run LaTeXML on this file, done.
    So far so simple (in theory). But I get errors I would like to have help with. To reproduce them just clone the repository http://github.com/KWARC/bibs (sorry could not really whittle down the problems).

When I do make kwarcpubs.bib.xml (corresponding to step 1. in the plan above), I get 14 errors of the form

Error:unexpected:_ Script _ can only appear in math mode
    Literal String \begin{bib#textrange(from=392;0,to=392;34)
    In Core::Definition::Primitive[Subscript] from TeX.pool.ltxml line 3412
     <= Core::Stomach[@0x7fcd366e4690] <= Core::Definition::Primitive[Begin] <= Core::Stomach[@0x7fcd366e4690] <= ...

only that the line in the textranges do not have underscores in the bibTeX source. I am not sure what happens there. But the result looks OK visually. But that does not really help me, since
when I do make extpubs.bib.xml I get a fatal due to too many errors.

When I do make mkohlhase-article.html, I get

make mkohlhase-article.html 
latexmlc --bibliography=kwarcpubs.bib.xml --bibliography=kwarccrossrefs.bib.xml --bibliography=extcrossrefs.bib.xml --format=html5 --destination=mkohlhase-article.html --log=mkohlhase-article.tex.ltxlog --css=bib.css mkohlhase-article.tex
No obvious problems
Wrote mkohlhase-article.html
make: *** [mkohlhase-article.html] Segmentation fault: 11
make: *** Deleting file `mkohlhase-article.html'

So there seems to be a problem in the postprocessing, but I cannot really track it down.
I would be grateful for any kind of fix.

@dginev

This comment has been minimized.

Collaborator

dginev commented Jun 14, 2016

Could you run latexmlc outside of the makefile and attach a latexml log with the segfault?

That would be very helpful.

@dginev dginev added this to the LaTeXML-0.8.3 milestone Jun 14, 2016

@kohlhase

This comment has been minimized.

Contributor

kohlhase commented Jun 14, 2016

Ah, I had forgotten that LaTeXML now writes log files even if it segfaults. Sorry for not giving you full information. Here is the relevant part.

Post-processing...
(Scan mkohlhase-article.html processing... 0.00 sec)
(MakeBibliography mkohlhase-article.html processing...
Error:malformed:document Document fails RelaxNG validation (LaTeXML)
    Validation reports: /Users/kohlhase/localmh/ext/perl5lib/lib/perl5/LaTeXML/resources/RelaxNG/Latexml-picture.rng:598: Relax-NG parser error : Element or text conflicts in interleave
    In Post::Document[mkohlhase-article.html] ->validate
     <= Post::Document[mkohlhase-article.html] <= Post::MakeBibliography[@0x7fab751e4858] <= ...

Error:malformed:document Document fails RelaxNG validation (LaTeXML)
    Validation reports: /Users/kohlhase/localmh/ext/perl5lib/lib/perl5/LaTeXML/resources/RelaxNG/LaTeXML-picture.rng:267: Relax-NG parser error : Element or text conflicts in interleave
    In Post::Document[mkohlhase-article.html] ->validate
     <= Post::Document[mkohlhase-article.html] <= Post::MakeBibliography[@0x7fab751e4858] <= ...

Error:malformed:document Document fails RelaxNG validation (LaTeXML)
    Validation reports: /Users/kohlhase/localmh/ext/perl5lib/lib/perl5/LaTeXML/resources/RelaxNG/LaTeXML-picture.rng:267: Relax-NG parser error : Element or text conflicts in interleave
    In Post::Document[mkohlhase-article.html] ->validate
     <= Post::Document[mkohlhase-article.html] <= Post::MakeBibliography[@0x7fab751e4858] <= ...
 [using bibliographies kwarcpubs.bib.xml,kwarccrossrefs.bib.xml,extcrossrefs.bib.xml] [1391 bibentries, 36 cited] 0.35 sec)
(CrossRef mkohlhase-article.html processing...
Info:expected:ids Missing items:
      Usable title for ID: p1
 0.02 sec)
(MathML::Presentation mkohlhase-article.html 8 to process... 0.00 sec)
(XSLT[using LaTeXML-html5.xsl] mkohlhase-article.html processing... 0.03 sec)
(Writer mkohlhase-article.html processing... 0.00 sec) 0.40 sec)
Post-processing complete: 3 errors
processing finished Tue Jun 14 13:21:48 2016
Status:conversion:0 
@dginev

This comment has been minimized.

Collaborator

dginev commented Jun 14, 2016

This may surprise you, but it looks like the sergfault did not come from latexmlc here - this log is harmless.

@kohlhase

This comment has been minimized.

Contributor

kohlhase commented Jun 14, 2016

It does surprise me. I am getting

latexmlc --bibliography=kwarcpubs.bib.xml --bibliography=kwarccrossrefs.bib.xml --bibliography=extcrossrefs.bib.xml --format=html5 --destination=mkohlhase-article.html --log=mkohlhase-article.tex.ltxlog  mkohlhase-article.tex
No obvious problems
Wrote mkohlhase-article.html
Segmentation fault: 11

what else should be involved in the segmentation fault?

@kohlhase

This comment has been minimized.

Contributor

kohlhase commented Jun 14, 2016

Interestingly, if I leave out the --format=html5 --destination=kohlhase-article.html options, then I do not get a segmentation fault, very weird.

@dginev

This comment has been minimized.

Collaborator

dginev commented Jun 14, 2016

If it looks like it happened this late, it may be terminating the perl process (i.e. latexmlc) itself. I have had this problem with Ruby recently, where the simple act of exiting a rails console segfaults the process.

It may relate to your current Perl installation, and/or to how the C-wrapping Perl packages have been installed. Now that I think about it, libxml is always suspect to segfault upon global cleanup, especially if you are using a threaded Perl. I had seen segfaults due to threading when writing the Rust libxml wrapper.

That may be pretty hard to debug if it isn't in the log however, since we don't know where exactly the issue hit. There are various ways to ask for more info, such as:

perl -d:Trace /path/to/latexmlc ...

Leaving out the options you mentioned omits certain heavy libxml operations (such as serialization), so it's a good lead.

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Jun 14, 2016

On 06/14/2016 07:29 AM, Deyan Ginev wrote:

This may surprise you, but it looks like the sergfault did not come from
latexmlc here - this log is harmless.

Doesn't surprise me: Perl, for all it's quirks, is normally hard to
segfault! But not impossible, especially with external libs like libxml2,
as Deyan said.

When I run the make you suggested, I get a log with
28 errors; 13 undefined macros[\url, \March, \January, \omdoc,
\svnrepoat, \selfedit, \July, \April, \openmath, \September,
\projectpageat, \seen, \webpageat], so I'm missing something; a preload?

@kohlhase

This comment has been minimized.

Contributor

kohlhase commented Jun 14, 2016

hmmm, for me make kwarcpubs.bib.xml expands to

make kwarcpubs.bib.xml -B
latexmlc kwarcpubs.bib --bibtex --includestyles --preload=kwarcbibs.sty.ltxml --destination=kwarcpubs.bib.xml --log=kwarcpubs.bib.ltxlog
14 errors
Wrote kwarcpubs.bib.xml
Michaels-MBP:bibs kohlhase$ 

and that has a preload of kwarcbibs.sty.ltxml in the same dir. and that works for me.

@kohlhase

This comment has been minimized.

Contributor

kohlhase commented Jun 15, 2016

I get 14 errors of the form

I have fixed that. so now only the segfault is still there. I will try to see whether this is mac-specific.

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Dec 5, 2016

Any news here?

@brucemiller brucemiller closed this May 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment