Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.2
-
None
-
None
-
Normal
-
Components: Pipeline - 1.0.0
Description
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.
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.