alphakevin / unoconv-server

A simple RESTful server for converting documents using unoconv
MIT License
21 stars 15 forks source link

Error: Unable to connect or start own listener. Aborting #2

Open CReimer opened 5 years ago

CReimer commented 5 years ago

I wanted to test how stable this is for a project of mine with a high workload So I started 5 while true loops with curl in it to see how unoconv-server handles this.

At first everything seemed fine, but after a few minutes I started seeing these error messages

unoconv --format pdf --output /tmp/dbfa20ed-581d-4f97-8355-6477d9576716.pdf /tmp/dbfa20ed-581d-4f97-8355-6477d9576716.ods
Error: Failed to connect to /usr/lib/libreoffice/program/soffice.bin (pid=27433) in 6 seconds.
Connector : couldn't connect to socket (Connection refused)
Error: Unable to connect or start own listener. Aborting.

    at ChildProcess.handler.on (/home/christopher/Projects/node_modules/unoconv-server/lib/converter.js:148:25)
    at ChildProcess.emit (events.js:188:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
Error: Failed to connect to /usr/lib/libreoffice/program/soffice.bin (pid=27449) in 6 seconds.
Connector : couldn't connect to socket (Connection refused)
Error: Unable to connect or start own listener. Aborting.

    at ChildProcess.handler.on (/home/christopher/Projects/node_modules/unoconv-server/lib/converter.js:148:25)
    at ChildProcess.emit (events.js:188:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
Error: Failed to connect to /usr/lib/libreoffice/program/soffice.bin (pid=27450) in 6 seconds.
Connector : couldn't connect to socket (Connection refused)
Error: Unable to connect or start own listener. Aborting.

    at ChildProcess.handler.on (/home/christopher/Projects/node_modules/unoconv-server/lib/converter.js:148:25)
    at ChildProcess.emit (events.js:188:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
POST /convert/format/pdf
[ '--format', 'pdf' ] { format: 'pdf' } '/tmp/26f0beb2-fd2e-45d0-8502-beb0d2d63354.pdf'
jonasrydenhag commented 5 years ago

LibreOffice doesn't work well with concurrent processes, I added a simple express-queue here, https://github.com/Yaraku/unoconv-server, that handles the requests one by one. I haven't really had the time to really stress test it, but in some simple tests that I made it seems like LibreOffice becomes more stable. You could check it out.

alphakevin commented 5 years ago

Sorry for replying late, it seems @jonasrydenhag 's fork would work more stable.

if you have a lot of workload, and need fast response, consider starting several docker containers, and use nginx as reverse-proxy for load balance http://nginx.org/en/docs/http/load_balancing.html.

We have production use of about 500 users, in regular OA software, single instance, and it's fine.

I will merge the fork, and find some solution better solution for this