Return-Path: X-Original-To: apmail-cocoon-dev-archive@www.apache.org Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E834E105B1 for ; Sat, 30 Nov 2013 14:28:08 +0000 (UTC) Received: (qmail 20288 invoked by uid 500); 30 Nov 2013 14:27:51 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 20186 invoked by uid 500); 30 Nov 2013 14:27:41 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 20166 invoked by uid 99); 30 Nov 2013 14:27:39 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Nov 2013 14:27:39 +0000 Date: Sat, 30 Nov 2013 14:27:39 +0000 (UTC) From: "Javier Puerto (JIRA)" To: dev@cocoon.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (COCOON-2340) XMLByteStreamCompiler in not thread-safe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COCOON-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Javier Puerto reassigned COCOON-2340: ------------------------------------- Assignee: Javier Puerto > 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 > Assignee: Javier Puerto > > 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)