WeBWorK Main Forum

pdflatex spawned processes that take up a lot of cpu capacity

pdflatex spawned processes that take up a lot of cpu capacity

by Wai Yan Pong -
Number of replies: 2

Our webwork server is running on Ubuntu 20.04 lts. All of a sudden (or maybe related to the last Ubuntu update) 

www-data spawns out pdflatex processes that eat a lot of cpu time to the point that it crashed the server. 

After rebooting it, things look fine for a while, but the pdflatex processes got spawned out again (perhaps students are trying to make hardcopies)

Here is a typical line of what htop shows:

www-data 20 0 118M 43148 4604 R 100. 0.5 3h23:05 /usr/bin/pdflatex --no-shell-escape hardcopy

here 100 is the cpu%. Looks like the process (pdflatex) is hung up and not existing.

How can we fix this, any help is greatly appreciated.


In reply to Wai Yan Pong

Re: pdflatex spawned processes that take up a lot of cpu capacity

by Danny Glin -

That command definitely looks like it's coming from the hardcopy generation.  Based on the fact that the pdflatex command is running away it seems like the hardcopy.tex file is being generated, but when pdflatex tries to compile it into a pdf something goes wrong.

Here are some things to check:

  • Try generating a hardcopy yourself to see if it times out.
  • If there are errors when WW tries to generate a pdf hardcopy, then it doesn't delete the temporary files that it uses to generate the pdf.  They are stored in /opt/webwork/webwork2/htdocs/tmp/[coursename]/hardcopy.  If the hardcopy generation is failing gracefully you will see a subdirectory called work.[somerandomstring] for each failed pdf generation.  Check to see if any of these directories exist.  If so, you can inspect the files in some of those directories:
    You can look at the pdflatex.stderr and pdflatex.stdout files in these directories to see if there is anything there that hints to the problem.
    You can also try manually running pdflatex on the hardcopy.tex file in one of those subdirectories to see if it completes, or if it runs away as well.
  • Try generating a tex file from the hardcopy generator (chose "TeX Source" as the hardcopy format), and then run pdflatex on that file on your WW server to see if it works.
  • Check to see if any of your users is trying to generate a hardcopy for a large number of sets/problems/users at once.  I suspect that this isn't the problem, as I would expect this to time out before the tex file was even generated.


In reply to Danny Glin

Re: pdflatex spawned processes that take up a lot of cpu capacity

by Glenn Rice -

Note that it is quite likely that this is caused by a specific homework set in a particular class, and most likely a particular problem in that set.

Also, for those viewing this in the future, note that Danny's information about where the temporary files are stored is valid for WeBWorK 2.16 and before.  As of WeBWorK 2.17 those files will be stored in /opt/webwork/webwork2/tmp/[coursename]/hardcopy.  Furthermore, those files will not be publicly accessible.  Only the user that generated the files will have access to them from the web.