google-code-export / jodconverter

Automatically exported from code.google.com/p/jodconverter
3 stars 2 forks source link

CRITICAL: LinuxProcessManager kills ALL processes #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the office process couldn't be started, OfficeProcess.pid stays at value 
PID_UNKNOWN. As no check is performed, this id is used to stop the process (due 
to ManagedOfficeProcess.stopAndWait or restartAndWait for instance). 

As PID_UNKNOWN = -1, it ends with a kill -KILL -1 and according to man kill:

kill -9 -1
              Kill all processes you can kill.

Original issue reported on code.google.com by mguille...@yahoo.fr on 7 Dec 2011 at 10:16

Attachments:

GoogleCodeExporter commented 9 years ago
What? kill -1 kills all processes? Damn, this is probably the most embarassing 
bug I've ever written. :-/

Patch accepted as defensive, but we still need to 1. understand why the pid 
could not be found (never seen this on Linux); and 2. ideally fail fast rather 
than deferring the error until the first restart.

Original comment by mirko.na...@gmail.com on 7 Dec 2011 at 8:28

GoogleCodeExporter commented 9 years ago
Issue 95 has been merged into this issue.

Original comment by mirko.na...@gmail.com on 7 Dec 2011 at 8:32

GoogleCodeExporter commented 9 years ago
I was bluffed reading the effect of kill -9 -1 too!

The patch is not ideal, I agree. The reason why the PID couldn't be determined 
is that startup failed because an older office process was still here.

Original comment by mguille...@yahoo.fr on 8 Dec 2011 at 8:07

GoogleCodeExporter commented 9 years ago
I still can't reproduce the issue. If an older process is still running then 
starting a new one should fail with something like

IllegalStateException: a process with acceptString 
'socket,host=127.0.0.1,port=2002' is already running; pid 7843

There must be some situation in which LinuxProcessManager.findPid() fails to 
detect an existing process, but I'm not sure exactly how.

Original comment by mirko.na...@gmail.com on 1 Jan 2012 at 4:19

GoogleCodeExporter commented 9 years ago
Change in r220 to fail fast if the pid cannot be found.

Original comment by mirko.na...@gmail.com on 1 Jan 2012 at 4:56

GoogleCodeExporter commented 9 years ago
Issue 104 has been merged into this issue.

Original comment by mirko.na...@gmail.com on 19 Feb 2012 at 9:56

GoogleCodeExporter commented 9 years ago
The scenario is the folloning:
We are using a single X-Server and work with a few Clients on it.
We have the jodconverter within a jboss, meaning we start the manager together 
with the jboss. If 2 people start their jboss, only the first one will succeed 
in starting it fully, the second one will receive a message like:
IllegalStateException: a process with acceptString 
'socket,host=127.0.0.1,port=2002' is already running; pid 7843
This doesnt stop the jboss with the not correctly started jodconverter from 
calling the shutdown-methodes of jodconverter when it is asked to shutdown, 
resulting in the user getting logged out from x completely.

Original comment by cola_co...@ki.tng.de on 19 Feb 2012 at 1:32