Commit graph

407 commits

Author SHA1 Message Date
Eric Mc Sween
44bf38d6db Decaf cleanup: convert async function to sync
The examineOldContainer() function doesn't need to use callbacks since
it only does synchronous work.
2020-09-03 15:13:04 -04:00
Eric Mc Sween
2584586ba2 Decaf cleanup: camel-case variables 2020-09-03 15:13:04 -04:00
Eric Mc Sween
c52d7d8f02 Decaf cleanup: simplify null checks 2020-09-03 15:13:04 -04:00
Eric Mc Sween
ee4c08868c Decaf cleanup: remove default callbacks 2020-09-03 15:13:04 -04:00
Eric Mc Sween
32f0bbe266 Decaf cleanup: remove IIFEs 2020-09-03 15:13:04 -04:00
Eric Mc Sween
f650da8675 Decaf cleanup: remove __guard__ 2020-09-02 17:06:35 -04:00
Eric Mc Sween
99648341e2 Decaf cleanup: remove unnecessary returns 2020-09-02 16:58:41 -04:00
Eric Mc Sween
08be54a43e Decaf cleanup: remove unnecessary Array.from() 2020-09-02 16:45:49 -04:00
Jakob Ackermann
1d1b9ebebc [misc] bump the dev-env to 3.3.2 2020-08-10 17:01:11 +01:00
Jakob Ackermann
5846ebb367 Merge pull request #182 from overleaf/msm-fix-npe-community-edition
Fixed NPE when Settings.clsi is defined but Settings.clsi.docker is not
2020-07-15 11:01:08 +02:00
Jakob Ackermann
0f9d0d9790 Merge pull request #183 from overleaf/jpa-clsi-allowed-image-names
[misc] RequestParser: restrict imageName to an allow list and add tests
2020-07-15 10:58:36 +02:00
Jakob Ackermann
c3a3ed341b Merge pull request #132 from das7pad/hotfix-double-call
[LocalCommandRunner] run: block a double call of the callback
2020-07-03 12:58:25 +02:00
Jakob Ackermann
f703b2ca41 [misc] move the image check prior to the base image override 2020-07-01 10:01:25 +01:00
Jakob Ackermann
aa02df7b81 [misc] apply review feedback
- move setting into clsi.docker namespace
- rename the variable for images to allowedImages / ALLOWED_IMAGES
- add an additional check for the image name into the DockerRunner

Co-Authored-By: Brian Gough <brian.gough@overleaf.com>
2020-06-30 12:01:21 +01:00
Jakob Ackermann
c857371fed [misc] wordcount: restrict image to an allow list and add tests 2020-06-26 13:28:12 +01:00
Jakob Ackermann
8846efe7ce [misc] RequestParser: restrict imageName to an allow list and add tests 2020-06-26 13:28:09 +01:00
Miguel Serrano
f8ca906393 Fixed NPE when Settings.clsi is defined but Settings.clsi.docker is not 2020-06-25 12:31:10 +02:00
Brian Gough
2b342c6e53 Merge pull request #181 from overleaf/bg-fix-503-response
handle EPIPE errors in CompileController
2020-06-22 09:30:35 +01:00
Brian Gough
22480f1a52 handle EPIPE errors in CompileController 2020-06-18 09:54:18 +01:00
Brian Gough
bdebef91eb Merge branch 'master' into bg-add-compile-groups 2020-06-17 11:58:26 +01:00
Brian Gough
f6fddf2944 Merge pull request #179 from overleaf/bg-fix-synctex-error
fix synctex error
2020-06-16 08:57:54 +01:00
Brian Gough
2eb4327256 fix format 2020-06-16 08:45:53 +01:00
Brian Gough
f41b4daca2 Merge branch 'master' into bg-use-lodash 2020-06-16 08:35:17 +01:00
Brian Gough
2ce03f0554 add initial compileGroup support 2020-06-15 15:28:53 +01:00
Brian Gough
ede70b6f99 migrate from underscore to lodash 2020-06-15 09:52:21 +01:00
Brian Gough
5368630754 check output file exists before running synctex 2020-06-12 15:15:27 +01:00
Tim Alby
d3ff214b88 partially revert "[DockerRunner] fix metric incrementing and error logging"
This reverts commits:
- 2b2fcca39ce8dee0fdc0c342aa0d6c822592bcec
- 9e82ab0890c5cc8c7fb95362c3f7edbcaad0cf29
- e3da458b376871c3ce72d6984d14bf1ee668b04b
2020-06-11 12:51:26 +02:00
Brian Gough
3d6b911295 add setting TEXLIVE_OPENOUT_ANY 2020-06-04 11:47:22 +01:00
Brian Gough
aa44bae222 fix eslint errors 2020-06-02 09:51:34 +01:00
Brian Gough
a3d27b63f1 fix formatting with make format_fix 2020-06-02 09:18:38 +01:00
Brian Gough
d9265b779f Merge pull request #170 from overleaf/jpa-import-141
[DockerRunner] destroyOldContainers: fix a race confition
2020-06-02 09:04:59 +01:00
Brian Gough
59cd14e160 Merge pull request #169 from overleaf/bg-record-latexmk-output
record latexmk output
2020-06-02 09:03:43 +01:00
Jakob Ackermann
563a973388 [DockerRunner] destroyOldContainers: normalize the container name
The docker api returns each name with a `/` prefix.

In order to not interfere with pending compiles, the deletion process
 has to acquire an internal lock on the container. The LockManager uses
 the plain container name without the slash: `project-xxx`.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-05-29 11:28:26 +01:00
Brian Gough
6d5dfb7758 clean up log file deletion and add unit test 2020-05-20 14:12:08 +01:00
Brian Gough
63770bf390 clean up the stdout/stderr recording 2020-05-20 11:45:29 +01:00
Henry Oswald
5c3da905ba Merge pull request #162 from overleaf/ta-jpa-epipe-retry
[DockerRunner] retry container inspect on EPIPE
2020-05-19 11:15:25 +01:00
Henry Oswald
2547725f35 Merge pull request #164 from overleaf/bg-fix-buffer-deprecations
fix deprecated usage of Buffer constructor
2020-05-19 10:26:56 +01:00
Henry Oswald
e9c6f3b074 Merge pull request #163 from overleaf/bg-use-encoding-on-process-output
set encoding when reading from streams
2020-05-19 10:26:26 +01:00
Henry Oswald
457b7d6657 Merge pull request #165 from overleaf/ho-retry-url-downloads
add pipeUrlToFileWithRetry for file downloads
2020-05-19 10:25:19 +01:00
Henry Oswald
3925839c7f add refreshExpiryTimeout function
on clsi all data lives inside of / dir
dynamically reduce size of EXPIRY_TIMEOUT if disk starts to get full
2020-05-18 15:17:19 +01:00
Brian Gough
3db513cfc9 record latexmk output 2020-05-15 16:08:10 +01:00
Henry Oswald
77e8ba74a7 add pipeUrlToFileWithRetry function to retry file downloads 3 times 2020-05-14 13:24:58 +01:00
Brian Gough
4947abe88b fix deprecated usage of Buffer constructor 2020-05-07 10:42:05 +01:00
Brian Gough
8e86f02c43 set encoding when reading from streams
using .toString() works most of the time but can lead to utf8 characters being
broken across chunk boundaries.

https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding
2020-05-07 10:30:14 +01:00
Henry Oswald
e1c90ec234 Merge branch 'master' into bg-support-other-runtimes
port coffee changes to js
2020-04-23 13:59:05 +01:00
Jakob Ackermann
cf8533bee1 [LocalCommandRunner] run: block a double call of the callback
The subprocess event handler fires the "error" and "close" event in case
 of a failure.
Both events would call the given callback, resulting in double
 processing of the subprocess result downstream.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2020-04-16 15:55:55 +02:00
Jakob Ackermann
cb9e9321f0 [DockerRunner] fix metric incrementing and error logging
- do not log on first EPIPE
- inc 'container-inspect-epipe-error' on permanent error only

Co-Authored-By: Tim Alby <timothee.alby@gmail.com>
2020-04-10 14:44:57 +02:00
Tim Alby
ecaa7035f5 add metrics for EPIPE errors
Co-Authored-By: Jakob Ackermann <jakob.ackermann@overleaf.com>
2020-04-10 12:28:48 +02:00
Tim Alby
e3b1472c7f retry once on EPIPE errors
Co-Authored-By: Jakob Ackermann <jakob.ackermann@overleaf.com>
2020-04-10 12:28:11 +02:00
Jakob Ackermann
c700a0ab9d Merge pull request #159 from overleaf/jpa-fix-docker-modem-error-scheme
[misc] keep up with the error signature of dockerode/docker-modem
2020-04-03 14:04:06 +02:00
Jakob Ackermann
6777432569 [misc] add a metric for failing downloads 2020-04-03 12:35:40 +02:00
Jakob Ackermann
4a19f022fc [misc] keep up with the error signature of dockerode/docker-modem
https://github.com/apocas/docker-modem/blob/v2.1.1/lib/modem.js#L296
2020-03-27 10:39:45 +01:00
mserranom
d5bd1790a8 updated sequelize 2020-03-16 16:31:02 +01:00
mserranom
cf6c8ab496 removed mkdirp dependency and replaced with fs.mkdir 2020-03-12 10:22:08 +01:00
mserranom
fa37ed865a added container monitor cleanup to fix hanging tests 2020-02-20 17:24:28 +01:00
mserranom
8729acd48c prettier: convert app/js decaffeinated files to Prettier format 2020-02-19 12:14:37 +01:00
mserranom
3af6bdd588 decaffeinate: rename app/coffee dir to app/js 2020-02-19 12:14:34 +01:00
decaffeinate
beb6100e25 decaffeinate: Run post-processing cleanups on CommandRunner.coffee and 25 other files 2020-02-19 12:14:28 +01:00
decaffeinate
4eab36e3d5 decaffeinate: Convert CommandRunner.coffee and 25 other files to JS 2020-02-19 12:14:14 +01:00
decaffeinate
2d07bab23d decaffeinate: Rename CommandRunner.coffee and 25 other files from .coffee to .js 2020-02-19 12:14:01 +01:00
mserranom
e37c261bb0 removed unneeded default function arg preventing from decaffeination 2020-02-19 12:06:09 +01:00
Brian Gough
659cd44377 support other runtimes 2020-02-10 16:10:18 +00:00
Eric Mc Sween
58bc71a0d2 Show output files in subfolders
This fixes a tiny regexp bug that prevents output files in subfolders
from being shown in the "Other logs & files" panel.

We also downgrade the corresponding log because it's very noisy and does
not indicate a problem.
2019-11-07 08:27:24 -05:00
Eric Mc Sween
dab6e9aa8e Send output files on timeout
The unconventional use of callbacks to return both an error and data
after compilation created a subtle bug where the output files were
dropped by the LockManager in case of an error such as a timeout.

This prevented the frontend to show error logs when a timeout occurs,
creating confusion among users.

We now attach the output files to the error so that they reach the
controller and are sent back to the web service.
2019-10-22 16:31:37 -04:00
Tailing Yuan
68e842b12a fix CompileManager and LocalCommandRunner 2019-10-04 23:02:03 +08:00
Shane Kilkelly
880ec16827 Increase the hard-timeout to 10 minutes.
In practice most projects will still be limited to five minutes,
but this allows us to bump up the limit for some projects,
especially legacy v1 projects that have been imported to v2
2019-06-06 16:39:16 +01:00
Michael Mazour
1ddf9283f2 Add flags option to request JSON
Adds a `flags` parameter to the request JSON, appearing under the `compile.options` key (alongside such stalwarts as `compiler`, `timeout`, etc.).

This is primarily to support `-file-line-error` as an option, but could have other uses as well.

`flags` should be an array of strings, or absent. If supplied, the listed arguments are added to the base latexmk command.
2019-05-14 16:24:34 +01:00
Henry Oswald
900e2f70b4 change console.log for logger.log 2019-03-22 20:42:26 +00:00
Brian Gough
038c81f868 use explicit json content-type to avoid security issues with text/html 2019-02-12 16:54:59 +00:00
Christopher Hoskin
3829732494 Fix broken spacing 2019-01-16 15:12:23 +00:00
Henry Oswald
c67e88fcb3 have failed compiles warn rather than be an error 2018-11-23 15:10:35 +00:00
Brian Gough
55fa22caa9 fix exception when content undefined in TikzManager 2018-10-15 10:01:52 +01:00
Brian Gough
187786b4e4 improve log message 2018-10-12 10:49:54 +01:00
Brian Gough
34acce8bda use TikzManager to create main file for pstool package 2018-10-10 16:13:20 +01:00
Brian Gough
74dd560979 extend caching for tikz, minted and markdown files 2018-10-04 16:56:48 +01:00
Brian Gough
9870683ae8 Merge pull request #96 from sharelatex/bg-cache-eps-to-pdf-converted-files
cache pdf files generated by epstopdf
2018-09-11 13:31:26 +01:00
Henry Oswald
3fc3cd11f4 fix unit tests 2018-09-11 10:21:37 +01:00
Henry Oswald
4a7cbef3e5 Merge branch 'master' into ho-dockerise 2018-09-11 10:02:24 +01:00
Henry Oswald
ce44fa3390 bump wordcount timeouts, taken from 82b996b145196711e439d7d7045f53498c1afa1a 2018-09-11 09:55:10 +01:00
Henry Oswald
bec46504eb improve synctex logging 2018-09-11 09:51:20 +01:00
Brian Gough
5a635e5465 cache pdf files generated by epstopdf 2018-09-11 09:44:22 +01:00
Henry Oswald
905a761544 don't error on a bad synctex call 2018-08-23 11:32:50 +01:00
Henry Oswald
250f4a42f0 reduce log level 2018-08-23 11:16:28 +01:00
Henry Oswald
59638c261d fse.ensureDir when running synctex and wordcount 2018-08-23 08:34:18 +01:00
Henry Oswald
2aaadc6124 fix unit tests 2018-08-23 00:21:05 +01:00
Henry Oswald
a80700f3e4 improve error reporting 2018-08-23 00:00:43 +01:00
Henry Oswald
6c0665bb49 change sync to async for lockfile debugging 2018-08-22 22:17:02 +01:00
Henry Oswald
40f4357cd6 fix sql query checking last access time 2018-08-22 18:21:15 +01:00
Henry Oswald
9f5fbefb8a add log on exited error code 2018-08-21 12:02:12 +01:00
Henry Oswald
f0b927e8e2 improve error reporting 2018-08-20 10:12:32 +01:00
Henry Oswald
e61907bf48 added loads of debugging 2018-08-19 11:38:27 +01:00
Henry Oswald
361eaf9217 comment out erroring log for moment 2018-08-01 14:32:17 +01:00
Henry Oswald
6f926007d2 null check host options 2018-08-01 14:10:22 +01:00
Henry Oswald
44c0922a5b reduce logging 2018-08-01 13:59:09 +01:00
Henry Oswald
ac4d07352f make Settings.parallelSqlQueryLimit a config setting 2018-07-31 14:38:24 +01:00
Henry Oswald
cd5bcdd7ca fix expired projects command 2018-07-30 17:37:30 +01:00
Henry Oswald
f9754c4b95 fix missing cb’s 2018-07-30 17:01:59 +01:00
Henry Oswald
759988401b add db queue file for global db query queues 2018-07-30 16:46:47 +01:00
Henry Oswald
1080c2c428 added a queue with 1 concurency to db queries 2018-07-30 16:22:04 +01:00
Henry Oswald
daf40fc757 added some debugging 2018-07-30 15:18:25 +01:00
Henry Oswald
f2dfb718c6 add sync= off and read_uncommited=true to improve perf 2018-07-30 15:16:06 +01:00
Henry Oswald
dc225f6aa3 remove some console.logs 2018-07-30 15:11:41 +01:00
Henry Oswald
1ef8ea328c remove password from clsi for sql
sequalise fails when it is set to null
2018-07-30 14:04:33 +01:00
Henry Oswald
65679af0cb dd wal logging 2018-07-26 16:12:26 +01:00
Henry Oswald
e8c735e794 only set wal for sqlite 2018-07-17 12:53:07 +01:00
Henry Oswald
d840246d29 add PRAGMA journal_mode=WAL; 2018-07-17 12:50:33 +01:00
Henry Oswald
e46b6563c0 change override to leave image name so it works for wl_texlive 2018-07-16 17:25:14 +01:00
Henry Oswald
846c2b1e28 move texliveImageNameOveride further down request so it works for
compile tests
2018-07-13 11:52:49 +01:00
Henry Oswald
c8d3c39bea quick hack to overright image name further down stack 2018-07-13 11:46:37 +01:00
Henry Oswald
4ec8a423cb added texliveImageNameOveride 2018-07-13 10:37:22 +01:00
Henry Oswald
eb89ca1d3b added filestoreDomainOveride 2018-07-03 16:41:34 +01:00
Brian Gough
b95317c8fe increase timeout on wordcount 2018-06-25 14:06:18 +01:00
Henry Oswald
4c96abd6c5 grep works with command
updated build scripts
acceptence tests break, files are written as root when user is node
2018-03-29 17:07:22 +01:00
Henry Oswald
f496de6d13 don't put synctex in as a volume 2018-03-16 18:11:46 +00:00
Henry Oswald
fc594f7d8e add logging of docker options 2018-03-16 17:37:36 +00:00
Henry Oswald
48eb7129a7 add synctex back in 2018-03-16 16:22:39 +00:00
Henry Oswald
29dcef3b9e comment out synctex for moment 2018-03-16 16:04:26 +00:00
Henry Oswald
faedf16704 add log line for connecting to a db 2018-03-16 15:29:35 +00:00
Henry Oswald
bd0a7c3557 add logging in db.coffee 2018-03-14 15:44:58 +00:00
Henry Oswald
9a519f0d3d added docker runner into core codebase
supports both local command runner and docker runner

added docker files for tex live

also fixed tests so they exit correctly & removed debug lines
2018-03-14 15:44:49 +00:00
Henry Oswald
aa58b7a75f Merge branch 'ho-dockerise' of github.com:sharelatex/clsi-sharelatex into ho-dockerise 2018-03-02 18:31:09 +00:00
Henry Oswald
1320854da9 Merge branch 'master' into ho-dockerise 2018-03-02 18:16:16 +00:00
Henry Oswald
0589c8c544 Merge branch 'master' into ho-dockerise 2018-03-02 18:12:32 +00:00
Henry Oswald
f39d14bf1b unit tests pass, acceptence fail
uncomment tests
2018-03-02 17:34:41 +00:00
Henry Oswald
3399f55153 wip, docker container is correctly created 2018-03-02 17:14:23 +00:00
Henry Oswald
5cf3c904cb mvp
needs hacked pacth in docker runner

wip

most tests pass
2018-03-02 17:14:20 +00:00
Brian Gough
e18538bd38 log an error if core file is found in output 2018-01-03 15:41:31 +00:00
Brian Gough
3c937ce2d4 fix typo in log message 2017-10-02 15:45:09 +01:00
Brian Gough
392e96b81d move logging from SafeReader into caller
prevent unnecessary logging when looking at headers of files where
hitting the end of the file is expected.
2017-10-02 15:44:00 +01:00
Brian Gough
e209c48bd9 simplify tikzexternalize checks 2017-09-29 17:00:53 +01:00
Brian Gough
2bdba15bd5 keep tikzexternalize files 2017-09-29 16:02:23 +01:00
Brian Gough
ce51cc673f Merge branch 'bg-lock-compiles' 2017-09-28 13:16:29 +01:00
Brian Gough
a7cb7e6e4c use a separate function for hidden file check 2017-09-26 11:03:20 +01:00
Brian Gough
ef0db811e1 exclude hidden files from output
express static server doesn't serve them and rejects with 404
2017-09-26 10:42:59 +01:00
Brian Gough
2a23082c4e remove stat test for missing files 2017-09-26 09:48:09 +01:00
Brian Gough
d46943a7bb only exclude clsi-specific files from output list 2017-09-26 09:47:29 +01:00
Brian Gough
d464556f74 fix comment 2017-09-25 16:06:45 +01:00
Brian Gough
7f0e6f3eec lock compile directory 2017-09-22 16:19:33 +01:00
Brian Gough
81e8243827 fallback check for missing files
dot files are not examined by OutputFileFinder, so do an extra check to
make sure those exist

also check for any relative paths in the resources
2017-09-15 13:41:56 +01:00
Brian Gough
0a242bac3c rename saveProjectStateHash to saveProjectState 2017-09-08 13:56:40 +01:00
Brian Gough
66431fc2b8 log any missing files 2017-09-07 16:54:09 +01:00
Brian Gough
b8e8530a16 fix whitespace 2017-09-07 13:52:34 +01:00
Brian Gough
cbd3e32143 log error if state file is truncacted 2017-09-07 13:52:34 +01:00
Brian Gough
3d1c3a1d27 combine the resource state and resource list
to prevent them getting out of sync
2017-09-07 13:52:34 +01:00
Brian Gough
ea3ee82e74 added logging 2017-08-29 12:09:31 +01:00
Brian Gough
26f85ba75f read resource files safely
put a limit on the amount of data read
2017-08-18 11:17:01 +01:00
Brian Gough
a84c884fc9 splice state management into ResourceStateManager 2017-08-18 10:22:17 +01:00
Brian Gough
96b801b093 fix whitespace 2017-08-18 09:41:59 +01:00
Brian Gough
d3da4e1d3f ResourceWriter unit tests (wip) 2017-08-17 16:59:37 +01:00
Brian Gough
b901884248 avoid adding draft mode more than once 2017-08-17 15:03:37 +01:00