Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation time out variable settings #1166

Open
jmchantrein opened this issue Nov 16, 2023 · 2 comments
Open

Compilation time out variable settings #1166

jmchantrein opened this issue Nov 16, 2023 · 2 comments

Comments

@jmchantrein
Copy link

jmchantrein commented Nov 16, 2023

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.

@senyai
Copy link

senyai commented Nov 16, 2023

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.

@Musicminion
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants