[ https://issues.apache.org/jira/browse/COCOON-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13835758#comment-13835758 ]
Javier Puerto commented on COCOON-2340: --------------------------------------- Hi Ivan, By the error, you are using a pipeline with expires caching enabled and the problem seems to be retrieving an XML fragment (CInclude transformer?). With this information I can't investigate further, I've also used with others projects the expires caching in pipelines without any concurrency issues so I recommend you to provide a small pipeline fragment where the problem can be reproduced so we can take a look. Following the advices I've said in the previous comment, Apache Cocoon 2.2 should not have any concurrency problems. To found the possible cause you could use the "ab" tool (ApacheBench [1]) that comes with the Apache HTTPD server. Then comment everything that involves with your pipeline leaving just the generator and the serializer and start uncommenting and testing with "ab" tool with high concurrency, this way you can isolate the problematic component or pipeline. Good luck and salu2. [1] http://httpd.apache.org/docs/2.2/programs/ab.html > 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)