sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

simple tikz error causes latex build to hang with no easy way to kill running latex job (problem is that you can't easily kill it) #3783

Closed DrXyzzy closed 2 months ago

DrXyzzy commented 5 years ago

Reported by Amanda Loudon.

  1. Create a .tex file with the following:
    \documentclass{article}
    \usepackage{tikz}
    \begin{document}
    \begin{tikzpicture}
    \draw (-1.5,0) -- (1.5,0);
    \draw (0,-1.5) -- (0,1.5);
    \end{tikzpicture}
    \end{document}
  2. Build the document and view the .pdf preview.
  3. Remove the semicolon from the end of the first \draw statement and Save or Build.
  4. Observe that the build process hangs, with the lower left build status pane showing a spinner and the message Running Latex... latexmk -pdf -f -g -bibtex -synctex=1 -interaction=nonstopmode tkx.tex.
  5. Clicking the trash can and Force Rebuild in the "Build Control and Log" panel in the lower right do not help (see #3560).
  6. Workaround: Correct the error by replacing the missing semicolon, then open a .term and run pkill pdflatex.
haraldschilly commented 5 years ago

related: https://github.com/sagemathinc/cocalc/issues/3020

williamstein commented 2 months ago

I think the solution to this is:

That's it. latex is a very complicated programming language and it's totally impossible to know whether latex is properly processing the document or stuck in some weird infinite loop that will never terminate. Also, often people do have large documents where latex takes a LONG time to process them (several minutes) so a uniform timeout is a non-starter. But a stop button makes perfect sense, just like there is a top button with Jupyter.

@haraldschilly would your brand new async execution functionality make it easy to solve this problem, finally!? https://github.com/sagemathinc/cocalc/pull/7686

williamstein commented 2 months ago

Note as part of this, there shouldn't be any timeout by default at all. Instead, just let the user explicitly kill their running latex if they give up on it, and make it very clear one is running.

williamstein commented 2 months ago

Note -- this should also be sure to properly deal with multiple distinct clients trying to latex at the same time...