cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Puerto (JIRA)" <>
Subject [jira] [Commented] (COCOON-2340) XMLByteStreamCompiler in not thread-safe
Date Thu, 28 Nov 2013 09:37:40 GMT


Javier Puerto commented on COCOON-2340:


I've more familiar with the 2.2 version. I've experienced issues like you described and it
was by the following reasons, now works like a charm :). So, could you check the following?

* The components in the pipeline was declared as singleton instead of prototype. Some components
are not thread safe, use prototype scope to avoid this problem.
* The version 2.2 is using an older version of Apache Xalan. Upgrade to 2.2.1 or upgrade Xalan
to latest, see COCOON-2156.

Anyway, could you provide an example to reproduce the problem if it persists?


> XMLByteStreamCompiler in not thread-safe
> ----------------------------------------
>                 Key: COCOON-2340
>                 URL:
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2
>            Reporter: Ivan Lagunov
> I'm periodically getting the following exceptions in different places:
> Caused by: java.lang.ArrayIndexOutOfBoundsException
>         at java.lang.System.arraycopy(Native Method)
>         at org.apache.cocoon.components.sax.XMLByteStreamCompiler.getSAXFragment(
>         at org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline.processXMLPipeline(
> After debugging I've found the root cause. It happens due to multi-threading when one
thread allocates newbuf array, then another thread increments bufCount in write method and
then the first thread fails on System.arraycopy invocation.
> I suggest making getSAXFragment and write methods synchronized. It should resolve the
issue. If it helps, I'll provide a patch later.

This message was sent by Atlassian JIRA

View raw message