2.2.2 vs 3.0b4 in multi-thread stress test

1,338 views
Skip to first unread message

JB

unread,
Oct 19, 2011, 4:42:39 PM10/19/11
to JODConverter
Hello

I want to use jodconverter to convert lot of documents to pdf.

1/ I use the 2.2.2 release from com.artofsolving.
I develop a service to simplify the use of conversion.

ConverterStaticPool aConverterPool =
ConverterStaticPool.getInstance();
Converter aConverter = aConverterPool.getConverter();
aConverter.convert2pdf(…); // service is synchronized.

My load test is very simple:
3 Threads, use the same instance of Converter and convert 3 day
longs.

With the 2.2.2 release, I had to solve the problem of the memory leak
that crashes the OO process. I succeed with a one line script in the
cron
* * * * * /home/openoffice/OOwrapper.exe /home/openoffice/
startOOsrv31.exe > /dev/null 2>&1
#!/bin/sh
# startOOsrv31.exe
PROCESS_NAME=soffice.bin
ps auxw | grep -v grep | grep $PROCESS_NAME > /dev/null || touch /tmp/
OORestart.`date +%Y-%m-%d.%Hh%M` && $1

Everything is OK, 50000 documents (some are very big) converted in 3
days. An error every time the OO process crash (I plan to develop a
retry pattern in my service convert2pdf).

2/ I try to test the 3.0b4 release from google.
I had to develop a web service like 2.2.2 did.

I modify the OfficeDocumentConverter class in the core to had the
method:
public void convert(InputStream inputStream, DocumentFormat
inputFormat, OutputStream outputStream, DocumentFormat outputFormat)
throws OfficeException
I modify the webapp to add the class ConverterServiceServlet to expose
this “streamed” convert service.

Everything is OK, conversion works fines, I see that openoffice deamon
is started/restarted when needed (no need of cron scrypt anymore)…
Now I want to do my load test: 3 Threads, use the same instance of
Converter and convert 3 day longs.

And I have, sometime, the errors:
GRAVE: Servlet.service() for servlet [ConverterServiceServlet] in
context with path [/jodconverter30b4] threw exception [conversion
failed] with root cause
org.artofsolving.jodconverter.office.OfficeException: no office
manager available
at
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.execute(ProcessPoolOfficeManager.java:
76)
at
org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:
120)
at
org.artofsolving.jodconverter.sample.web.ConverterServiceServlet.doPost(ConverterServiceServlet.java:
99)

My test is very stressful, but when I see the source code, the 3.0
release would resist.
Have you an idea or fix to solve this problem that doesn’t occur in
the 2.2.2.

Mirko Nasato

unread,
Oct 26, 2011, 2:36:58 PM10/26/11
to JODConverter
OOo isn't very good at multi-threading, it has a tendency to crash if
you do multiple conversions simultaneously.

For this reason, JODConverter serialises conversions, i.e. only sends
one document at a time to OOo. So there's no much point in using
multiple client threads in your app because the final behaviour will
be single-threaded anyway.

That applies to both JODConverter 2.2 and 3.0. The only difference is
that 3.0 has a (configurable) timeout so if a conversion is kept in
the waiting queue for too long it will fail. So that's what you're
seeing.

What you can do to improve performance (and your machine has multiple
CPUs or cores) is start multiple OOo processes, which is one of the
new features in JODConverter 3.0. E.g.

OfficeManager officeManager = new DefaultOfficeManagerConfiguration()
.setPortNumbers(2002, 2003);

will start two OOo processes, one listening on port 2002 and the other
on 2003. As a rule of thumb, if you have 4 cores you can start up to 4
OOo processes for max performance.

Shervin Asgari

unread,
Oct 27, 2011, 4:31:59 AM10/27/11
to JODConverter
But if you are using PIPES, you can just add multiple PIPES instead
correct?
No need to define the number of ports according to cores right?

Shervin

Mirko Nasato

unread,
Oct 27, 2011, 2:04:39 PM10/27/11
to JODConverter
If you want to use named pipes rather than tcp ports then it's

OfficeManager officeManager = new DefaultOfficeManagerConfiguration()
.setPipeNames("office1", "office2")
.buildOfficeManager();

JB

unread,
Nov 3, 2011, 5:38:00 AM11/3/11
to JODConverter
Hi,

I modify the webapp project to make possible the following config :

<context-param>
<param-name>office.port</param-name>
<param-value>2002,2003,2004</param-value>
</context-param>

Now I've 3 instances of OO daemon waiting for conversion and it's
works fine.
There's no more exception “no office manager available”.

But this one appears :
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask
$Sync.innerGet(FutureTask.java:228)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at
org.artofsolving.jodconverter.office.PooledOfficeManager.execute(PooledOfficeManager.java:
85)
at
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.execute(ProcessPoolOfficeManager.java:
78)

Some of my test documents are very big, the timeout of 2 minutes
(120000ms) seems to be not enough, especially if 3 OO daemon works on
the same CPU.

My multi-thread test wants just to test the robustness of the
solution. I know that doing a multi-thread client to improve the
performance is useless when you have one and only instance of OO
daemon.

Waiting for the final release.

Thanks to Jodconvert contributor

Shervin Asgari

unread,
Nov 3, 2011, 7:43:27 AM11/3/11
to JODConverter
The current beta of JODConverter 3 is production ready.
We just have put it as beta because we still might change and break
the API.
So, if that is ok by you, then you can upgrade and use version 3 right
now.

Shervin

JB

unread,
Nov 3, 2011, 11:48:32 AM11/3/11
to JODConverter
Production ready ?
I have to modify the core and the webapp to develop the web services.
I have to modify the webapp to allow multi instance parameter.
I want to convert into PDF/A. With the 2.2.2 I just modify the
document-formats.xml file with the 3.0 I think that I have to modify
the core (DefaultDocumentFormatRegistry.java) once more... PDF/A is
what I investigate now...

It's also fun to do that....

Shervin Asgari

unread,
Nov 4, 2011, 4:47:34 AM11/4/11
to JODConverter
Se answers below

On Nov 3, 4:48 pm, JB <jbousi...@yahoo.fr> wrote:
> Production ready ?

Yes, we use it in production, and its quite stable

> I have to modify the core and the webapp to develop the web services.

Well, if you need that, then thats what you have to do. We have the
web services implementation in our roadmap, but havent had time to
develop this. Please provide a patch if you do this.

> I have to modify the webapp to allow multi instance parameter.

No you dont need to do that if you add multiple ports, or pipes. See
Configuration section for more details.

> I want to convert into PDF/A. With the 2.2.2 I just modify the
> document-formats.xml file with the 3.0 I think that I have to modify
> the core (DefaultDocumentFormatRegistry.java) once more... PDF/A is
> what I investigate now...

I have written a detailed blog how you can do this.

Take a look here: http://shervinasgari.blogspot.com/search/label/pdfa

Zhivko

unread,
Nov 4, 2011, 5:12:12 AM11/4/11
to JODConverter
I just want to share experience regarding LibreOffice / OpenOffice
usability with jodconverter tool.

I was experimentaly using LibreOffice 3.4.3 and I found out that in
case of using LibreOffice I had a lot of exceptions of this kind:

[26 okt 2011 17:57:08,800] INFO251964[OfficeProcessThread-0] -
OfficeProcess.forciblyTerminate(OfficeProcess.java:212) - trying to
forcibly terminate process:
'socket,host=127.0.0.1,port=8101,tcpNoDelay=1'
[26 okt 2011 17:57:08,925] INFO252089[MessageDispatcher] -
OfficeConnection$1.disposing(OfficeConnection.java:58) - disconnected:
'socket,host=127.0.0.1,port=8101,tcpNoDelay=1'
[26 okt 2011 17:57:08,925] WARN252089[MessageDispatcher] -
PooledOfficeManager$1.disconnected(PooledOfficeManager.java:50) -
connection lost unexpectedly; attempting restart
[26 okt 2011 17:57:09,050] INFO252214[OfficeProcessThread-0] -
ManagedOfficeProcess.doTerminateProcess(ManagedOfficeProcess.java:172)
- process forcibly terminated with code 1
[26 okt 2011 17:57:09,550] INFO252714[OfficeProcessThread-0] -
OfficeProcess.forciblyTerminate(OfficeProcess.java:212) - trying to
forcibly terminate process:
'socket,host=127.0.0.1,port=8101,tcpNoDelay=1'
[26 okt 2011 17:57:09,550]ERROR252714[ajp-8110-1] -
PdfGeneratorImpl.getOOPdf(PdfGeneratorImpl.java:746) -
org.artofsolving.jodconverter.office.OfficeException: task failed
at
org.artofsolving.jodconverter.office.PooledOfficeManager.execute(PooledOfficeManager.java:
96)
at
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.execute(ProcessPoolOfficeManager.java:
78)
at
org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:
90)
at
com.mobitel.templates.PdfGeneratorImpl.getOOPdf(PdfGeneratorImpl.java:
718)
at
com.mobitel.templates.PdfGeneratorImpl.getPdfMultiple(PdfGeneratorImpl.java:
460)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.xml.ws.api.server.InstanceResolver
$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:
257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:
93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:
243)
at com.sun.xml.ws.transport.http.HttpAdapter
$HttpToolkit.handle(HttpAdapter.java:444)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:
244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:
135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:
129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:
160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:
75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
172)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
174)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:
444)
at org.apache.coyote.ajp.AjpAprProtocol
$AjpConnectionHandler.process(AjpAprProtocol.java:472)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:
1286)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.concurrent.CancellationException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:230)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at
org.artofsolving.jodconverter.office.PooledOfficeManager.execute(PooledOfficeManager.java:
85)
... 36 more

Now I am back on using OpenOffice 3.2.1 as rendering engine, and those
exceptions are not happening... I am using single office in open
office pool and I am restarting it after 200 conversions in each
scenario.

Does anybody experienced something similar?

Mirko Nasato

unread,
Nov 13, 2011, 9:54:20 AM11/13/11
to JODConverter
On Nov 4, 8:47 am, Shervin Asgari <shervin.asg...@gmail.com> wrote:
> Se answers below
>
> On Nov 3, 4:48 pm, JB <jbousi...@yahoo.fr> wrote:
>
> > Production ready ?
>
> Yes, we use it in production, and its quite stable
>
Whether it's production-ready for a specific case is something every
project should determine based on their own requirements, and after
suitable testing. JODConverter is a volunteer effort and (speaking for
myself at least) cannot offer commercial support at the moment. For
one, there are multitudes of different OpenOffice.org/LibreOffice
versions and platforms (Linux/Windows/Solaris/Mac i386/x64 etc) and I
have nowhere near the time or resources to test all possible
combinations. That said, many people are using it successfully in
production.

> > I have to modify the webapp to allow multi instance parameter.
>
The jodconverter-sample-webapp is called like that precisely because
it's a sample; it's meant to be used as a starting point and
customised for your own needs.

Alex Vb

unread,
Nov 23, 2011, 7:28:35 AM11/23/11
to jodcon...@googlegroups.com
We have been using it in production for quite some time now but did have to make some custom modifications. For instance we had some vague timeouts to existing instances and instances that weren't killed properly which required manual intervention (kill process) to restart. We added some additional code to kill unreachable processes etc and haven't had a single problem since (several months of 100% uptime now).

Great tool!


--
You received this message because you are subscribed to the Google Groups "JODConverter" group.
To post to this group, send email to jodcon...@googlegroups.com.
To unsubscribe from this group, send email to jodconverter...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jodconverter?hl=en.


Arun Verma

unread,
Nov 23, 2011, 11:45:26 AM11/23/11
to jodcon...@googlegroups.com
Hi Alex

I am trying to use jobconverter on linux platform but have been a complete failure at it. Can you help me by sending the configuration files that you have employed to do the conversion for you.
Thanks and Regards
Arun Verma

Alex Vb

unread,
Nov 25, 2011, 7:27:28 AM11/25/11
to jodcon...@googlegroups.com
We run two OO3 instances (via sockets) with following configuration settings:
- maxTasksPerProcess = 200
- taskExecutionTimeout = 5 minutes
- taskQueueTimeout = 5 minutes

The problem we encountered was that if officeManager was unused for a while (a couple of hours or so), the next conversion would fail and JODConverter would not recover gracefully: it kept throwing exceptions for each conversion after that. I don't really remember the specifics but we solved it by adding some custom code.
Reply all
Reply to author
Forward
0 new messages