overleaf icon indicating copy to clipboard operation
overleaf copied to clipboard

Compilation time out variable settings

Open jmchantrein opened this issue 1 year ago • 2 comments

Expected Behaviour

Be able to set a compilation timeout variable environment via the variables.env file, for example.

Observed Behaviour

I seem to have documents that apparently compile without a timeout. This is annoying because they use CPU resources without releasing them. I tried to change the timeout value for compilation, but I couldn't find where this default value was defined in the source code or how to change it.

Analysis

Some things have been suggested here #805, but it seems outdated...

Questions

  1. Is there a default time-out setting for the compilation of documents ?
  2. If such a setting exists, could you please guide me on how to modify it ?

Thank you.

jmchantrein avatar Nov 16 '23 10:11 jmchantrein

I'd like to add my two cents here. Om my server some pdflatex projects get stuck forever (weeks!) eating 100% of the cpu. To overcome this I added this bash script to cron that kills latex processes running for more that 13 minutes.

#!/usr/bin/env bash
docker exec sharelatex bash -c "kill -9 \$(ps -eo etimes,pid,etime,args --sort -etimes | awk '\$4~/^(pdflatex|latex)/{if (\$1 > 13*60) print \$2 }')"
echo $(date) "exit code: $?"

So, what I'm saying is that if there's COMPILE_TIMEOUT somewhere it does nothing.

senyai avatar Nov 16 '23 11:11 senyai

First of all, let me answer your question.

  1. In overleaf CE, the default setting for compile is 180s(3 min).

https://github.com/overleaf/overleaf/blob/26ee64fe620a486eef8086884d616048b08fcf4e/server-ce/config/settings.js#L278C1-L287C5

  1. if you already run your overleaf CE in production mode, first of all you need to modify settting in the code above(or in env var setting), secondly, you need to update db of every user's compile time. since Compile timeout is stored in the mongodb. Check this

Run a script to update timeouts for existing users with db.users.updateMany({}, {'$set': {'features.compileTimeout': }})

There are some important point you need to know(also write for those who want to Enlarge or Decrease the timeout limit)

  1. Compile timeout is also limited by nginx conf, if you want to Increase the limit, don't forget to modify this https://github.com/overleaf/overleaf/blob/main/server-ce/nginx/sharelatex.conf and also you own nginx setting
  2. Compile timeout is stored in the MongoDB, so if you are upgrading your instance, you need to modify data in the MongoDB
  3. Don't modify code directly in the container, just build your own docker image

Musicminion avatar Jan 31 '24 06:01 Musicminion

Hello,

Thank you for getting in touch regarding compile timeouts. I'm afraid we do not enforce compile timeouts in Overleaf Community Edition. Compile timeouts can be enforced using our Sandboxed compiles mode as available in our Server Pro offering. I'm sorry for this limitation.

Greetings, Jakob

das7pad avatar Aug 28 '24 16:08 das7pad