import/export: Kill soffice spawned process after 120 seconds (#4499)

Due to libreoffice being buggy / hanging on certain pdf imports (even in 7.0.3) we should just kill it so it doesn't consume CPU indefinitely.
This commit is contained in:
John McLear 2020-11-20 23:33:31 +00:00 committed by GitHub
parent 06e0ff3cd3
commit 776eda2d4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,6 +89,12 @@ function doConvertTask(task, callback) {
task.srcFile,
'--outdir', tmpDir
]);
// Soffice/libreoffice is buggy and often hangs.
// To remedy this we kill the spawned process after a while.
setTimeout(function(){
soffice.stdin.pause(); // required to kill hanging threads
soffice.kill();
}, 120000);
var stdoutBuffer = '';