[ https://issues.apache.org/jira/browse/COCOON-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13835015#comment-13835015 ]
Javier Puerto commented on COCOON-2340: --------------------------------------- Hi Ivan, You are right, I thought that the 2.2.1 was released but it's not. You can apply the patch from COCOON-2156 to the tag http://svn.apache.org/repos/asf/cocoon/tags/cocoon-2.2/ About the singleton components, you can try yourself if you redeclare the Cocoon component with a different name and then use this one instead of the default one in the core. Anyway you should provide an example to reproduce the issue so I can take a look but I will not be able to review it until the weekend. Salu2. > XMLByteStreamCompiler in not thread-safe > ---------------------------------------- > > Key: COCOON-2340 > URL: https://issues.apache.org/jira/browse/COCOON-2340 > 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(XMLByteStreamCompiler.java:61) > at > org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline.processXMLPipeline(ExpiresCachingProcessingPipeline.java:152) > 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 (v6.1#6144)