eikek / eikek/docspell

unoconv only works with a pre-existing `unoconv -l` listener

Open
#1,814 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
2.3k
Forks
184
Avg merge
8h 2m
Merged PRs (30d)
4

Description

Here is my configuration

```
unoconv = {
command = {
program = "unoconv"
args = [
"-f",
"pdf",
"-o",
"{{outfile}}",
"{{infile}}"
]
timeout = "2 minutes"
}
working-dir = ${java.io.tmpdir}"/docspell-convert"
}
```

Uploading a **testdocument.odt** yields this in the logs

```
Oct 30 18:33:01 joex docspell-joex[165]: level="INFO" levelValue=300.0 message=">>> 2022-10-30T18:33:01.812099Z Info 4htHaYYYR.../coleman/re-process-item/Low: ===== Start reprocessing ======" fileName="LogSink.scala" className="docspell.scheduler.impl.LogSink" methodName="logInternal" line=41 column=null jobId="4htHaYYYRPK-sDtUCcGN2b5-sfayKYGcyWT-UY3L7M22n9D" task="re-process-item" group="coleman" jobInfo="4htHaYYYR.../coleman/re-process-item/Low" timestamp=1667154781813 date=2022-10-30 time=18:33:01.813+000
Oct 30 18:33:01 joex docspell-joex[165]: level="INFO" levelValue=300.0 message=">>> 2022-10-30T18:33:01.851515Z Info 4htHaYYYR.../coleman/re-process-item/Low: Converting file Some(testdocument.odt) (application/vnd.oasis.opendocument.text) into a PDF" fileName="LogSink.scala" className="docspell.scheduler.impl.LogSink" methodName="logInternal" line=41 column=null jobId="4htHaYYYRPK-sDtUCcGN2b5-sfayKYGcyWT-UY3L7M22n9D" task="re-process-item" group="coleman" jobInfo="4htHaYYYR.../coleman/re-process-item/Low" timestamp=1667154781852 date=2022-10-30 time=18:33:01.852+000
Oct 30 18:33:02 joex docspell-joex[165]: level="ERROR" levelValue=500.0 message=">>> 2022-10-30T18:33:02.778524Z Error 4htHaYYYR.../coleman/re-process-item/Low: PDF conversion failed: Command result=251. No output file found.. Go without PDF file" fileName="LogSink.scala" className="docspell.scheduler.impl.LogSink" methodName="logInternal" line=51 column=null jobId="4htHaYYYRPK-sDtUCcGN2b5-sfayKYGcyWT-UY3L7M22n9D" task="re-process-item" group="coleman" jobInfo="4htHaYYYR.../coleman/re-process-item/Low" timestamp=1667154782783 date=2022-10-30 time=18:33:02.783+000
```

Running unoconv with the same arguments manually converts the pdf successfully, so I doubt this is an issue with missing libraries.

One clue is this note from `man unoconv`

```
-n, --no-launch
By default if no listener is running, unoconv will launch its own (temporary)
listener to make sure the conversion works. This option will abort the conversion
if no listener is found, rather than starting our own listener.
```

I'm not sure, but `unoconv` might fork/daemonize a listener process in such a way that makes it inaccessible.

I'm going to make a dedicates systemd service that runs `unoconv -l`, since it does make things run faster, like you mention in the docs.

----

Update: I also tried setting `-T 5`, but it still didn't work.

```
-T, --timeout
When unoconv starts its own listener, try to connect to it for an amount of
seconds before giving up. Increasing this may help when you receive random errors
caused by the listener not being ready to accept conversion jobs.
```

This still didn't work. Only a pre-existing listener spawned with `unoconv -l` lets me process .odt LibreOffice docs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.