## WeBWorK Main Forum

### 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.