jodconverter / docker-image-jodconverter-examples

Docker image with jodconverter + libreoffice for document conversion through a REST api
https://github.com/sbraconnier/jodconverter
MIT License
72 stars 32 forks source link

Process recycling leads to defunct process #8

Closed gorille closed 4 years ago

gorille commented 4 years ago

After running for a while process start to accumulate inside the docker container. It seems that the openoffice process does not exit properly and survives as defunct

See the process here after around 3 month work:

# ps -ef               
UID        PID  PPID  C STIME TTY          TIME CMD
[...]
root        37     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root        49     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root        64     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root        96     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root       107     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root       122     1  0  2019 ?        00:00:00 [soffice.bin] <defunct>
root      1532     1  0 Mar01 ?        00:00:00 [soffice.bin] <defunct>
root      1543     1  0 Mar01 ?        00:00:00 [soffice.bin] <defunct>
root      1558     1  0 Mar01 ?        00:00:00 [soffice.bin] <defunct>

Log analysis shows that new process are started with PID = previous +2

# grep "pid:" /var/log/app*
/var/log/app.log:2019-07-04 09:52:50.419 DEBUG 1 --- [ProcessThread-0] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 39
/var/log/app.log:2019-07-04 09:52:50.803 DEBUG 1 --- [ProcessThread-0] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 66
/var/log/app.log:2019-07-04 09:52:51.195 DEBUG 1 --- [ProcessThread-1] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 98
/var/log/app.log:2019-07-04 09:52:51.555 DEBUG 1 --- [ProcessThread-1] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 124
/var/log/app.log:2020-03-01 10:08:29.952  INFO 1 --- [ProcessThread-1] org.jodconverter.office.OfficeProcess    : Trying to forcibly terminate process: 'host=127.0.0.1,port=2003,tcpNoDelay=1'; pid: 124
/var/log/app.log:2020-03-01 10:08:31.432 DEBUG 1 --- [ProcessThread-1] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 1534
/var/log/app.log:2020-03-01 10:08:31.794 DEBUG 1 --- [ProcessThread-1] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 1560
/var/log/app.log:2020-03-02 15:26:22.728 DEBUG 1 --- [ProcessThread-0] o.j.process.AbstractProcessManager       : Command line matches! Returning pid: 2498

My understanding is that the app detects the crash and restarts a new process. The issue is that this crash does not kill the old process

EugenMayer commented 4 years ago

I'am not sure this would be the right place to discuss it, since this is not docker-image container related, it should got to https://github.com/sbraconnier/jodconverter since the implementation to spawn or kill processes is in there

EugenMayer commented 4 years ago

You should also be aware that this is not really production ready, but as stated in the readme, https://github.com/EugenMayer/officeconverter should be - it does the same but it is not build as an example in that regard. Still, the issue you discovered could occur there too, IMHO