[luatex] lualatex / includegraphics / open files

Knut Petersen Knut_Petersen at t-online.de
Fri Dec 1 13:49:04 CET 2017


Hi everybody!

Assume that the files testa.pdf, testb.pdf and testc.pdf exist.

Further assume there is a file mwe.tex:

    \NeedsTeXFormat{LaTeX2e}
    \documentclass[12pt]{letter}
    \usepackage{shellesc,graphicx}
    \begin{document}
    \includegraphics{testa.pdf}\newpage
    \includegraphics{testb.pdf}\newpage
    \includegraphics{testc.pdf}\newpage
    \immediate\write18{ lsof | grep latex | grep test | less -S }
    \end{document}

If (on a linux system) you execute

    lualatex --shell-escape mwe


and

    xelatex --shell-escape mwe

you see a difference: the included pdf files are open if you use
lualatex, they are _not_open_ when xelatex is used.

That difference is not a problem if you want to include only a few
files, but it is a problem if you want to include a few thousands
of pdfs - on most sytems there is a limit of about 1024 open files.

That limit can be raised, but at least in my case that does
not really help: using write18 to start a program when many file
descriptors are open might expose a bug in the c++ library if "many"
is "more than 1023". If that child uses execve() to start another child,
that execve fails with a "*** buffer overflow detected ***" message.

Is this is a problem of luatex? I don't know, but I think it is.

Keeping all files that are included by \includegraphics open is a
wasteful use of limited system resources (file descriptors) , and xetex
demonstrates that it is not necessary.

BTW: In my tests xelatex fails to include more than 5005 pdfs correctly.
Pdfs 5005+ are read,  white space is reserved, but the actual content of
the included pdfs is missing. Nothing unusual is written to the log.

System used:

  * Linux, 64bit (i4790K, 32GB)
  * OpenSuSE Tumbleweed
  * LuaTeX, Version 1.0.4 (TeX Live 2017/TeX Live for SUSE Linux)
  * XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017/TeX Live for SUSE Linux)


Knut

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20171201/88642a0b/attachment.html>


More information about the luatex mailing list