alelimpo / jodconverter

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

java.util.concurrent.ExecutionException: org.artofsolving.jodconverter.office.OfficeException: could not terminate #105

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Before creating a new issue, please post your problem to the group for
discussion first.

http://groups.google.com/group/jodconverter

What steps will reproduce the problem?
1. We are using LibreOffice 3.4 on Windows
2. SigarProcessManage is used as process manager
3. ProcessPoolOfficemanage is used as office manager.
4. Currently only one socket connection with port 2002 is running.
5. The execution of a custom conversion task works, and completes successfully
6. We call officemanager.stop() at the end of the process
7. It throws the info message as 
      INFO: disconnected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
8. I can still see that soffice.bin is running from task manager ( or tasklist 
command)
9. It hangs for about 2.5 minutes.
10 Then throws the following error.

Mar 22, 2012 6:02:18 PM 
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager stop
INFO: stopping
Mar 22, 2012 6:02:18 PM org.artofsolving.jodconverter.office.OfficeConnection$1 
disposing
INFO: disconnected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
Mar 22, 2012 6:04:18 PM org.artofsolving.jodconverter.office.OfficeProcess 
forciblyTerminate
INFO: trying to forcibly terminate process: 
'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' (pid 4944)
Exception in thread "main" 
org.artofsolving.jodconverter.office.OfficeException: failed to start and 
connect
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.stopAndWait(ManagedOfficeProcess.java:77)
    at org.artofsolving.jodconverter.office.PooledOfficeManager.stop(PooledOfficeManager.java:108)
    at org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.stop(ProcessPoolOfficeManager.java:91)
    at com.lexmark.pws.aps.pe.handler.impl.OfficeConnectorUtil.closeConnection(OfficeConnectorUtil.java:86)
    at com.lexmark.pws.aps.pe.ThumbnailEngine.main(ThumbnailEngine.java:65)
Caused by: java.util.concurrent.ExecutionException: 
org.artofsolving.jodconverter.office.OfficeException: could not terminate 
process
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.stopAndWait(ManagedOfficeProcess.java:75)
    ... 4 more
Caused by: org.artofsolving.jodconverter.office.OfficeException: could not 
terminate process
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doTerminateProcess(ManagedOfficeProcess.java:174)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doEnsureProcessExited(ManagedOfficeProcess.java:164)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStopProcess(ManagedOfficeProcess.java:156)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.access$100(ManagedOfficeProcess.java:31)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess$2.run(ManagedOfficeProcess.java:71)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: kill failed
    at org.artofsolving.jodconverter.process.SigarProcessManager.kill(SigarProcessManager.java:62)
    at org.artofsolving.jodconverter.office.OfficeProcess.forciblyTerminate(OfficeProcess.java:207)
    at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doTerminateProcess(ManagedOfficeProcess.java:171)
    ... 10 more
Caused by: org.hyperic.sigar.SigarException: KILL: invalid signal specification
    at org.hyperic.sigar.Sigar.kill(Sigar.java:279)
    at org.artofsolving.jodconverter.process.SigarProcessManager.kill(SigarProcessManager.java:60)
    ... 12 more
Java Result: 1

What am I doing wrong. Should I issue another kill command to stop the 
soffice.bin ?
What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by papab...@gmail.com on 22 Mar 2012 at 1:04

GoogleCodeExporter commented 8 years ago
I have figured out how to avoid this, though not quiet sure if the best way to 
do.

ProcessManager processManager = new SigarProcessManager();
Sigar sigar = new Sigar();
long servicePid = processManager.findPid(new ProcessQuery("soffice.bin", ""));
//System.out.println(" Process id = " + servicePid);
// 9 = SIGTERM signal
sigar.kill(servicePid, 9);

This stops the soffice.bin.

Original comment by papab...@gmail.com on 28 Mar 2012 at 2:05