JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-5161

ArrayIndexOutOfBoundsException in CopyOnWriteArrayList

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 3.0.0
  • Fix Version/s: 3.0.1
  • Component/s: Core: Routing / Filters
  • Labels:
    None
  • User impact:
    High
  • Configuration:
    Hide

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd">
    <endpoint name="inbound.sync" address="vm://test.inbound.sync"/>
    <flow name="flowTestSync">
    <inbound-endpoint ref="inbound.sync" exchange-pattern="request-response"/>
    <!-- don't use the Mule echo-component; it will corrupt your byte[] messages -->
    <component class="EchoBytes"/>
    </flow>
    </mule>

    Show
    <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:spring="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd"> <endpoint name="inbound.sync" address="vm://test.inbound.sync"/> <flow name="flowTestSync"> <inbound-endpoint ref="inbound.sync" exchange-pattern="request-response"/> <!-- don't use the Mule echo-component; it will corrupt your byte[] messages --> <component class="EchoBytes"/> </flow> </mule>
  • Log Output:
    Hide
    Root Exception stack trace:
    java.lang.ArrayIndexOutOfBoundsException: 0
    at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList.search(CopyOnWriteArrayList.java:68)
    at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:131)
    at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet.add(CopyOnWriteArraySet.java:223)
    at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:57)
    at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:350)
    at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:90)
    at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:81)
    at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:113)
    at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:51)
    at org.mule.component.AbstractComponent$1.process(AbstractComponent.java:241)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.component.AbstractComponent.process(AbstractComponent.java:146)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.construct.AbstractFlowConstruct$1$1.process(AbstractFlowConstruct.java:103)
    at org.mule.processor.ExceptionHandlingMessageProcessor.process(ExceptionHandlingMessageProcessor.java:22)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:187)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:160)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:147)
    at org.mule.transport.vm.VMMessageReceiver.onCall(VMMessageReceiver.java:109)
    at org.mule.transport.vm.VMMessageDispatcher$1.doInTransaction(VMMessageDispatcher.java:89)
    at org.mule.transport.vm.VMMessageDispatcher$1.doInTransaction(VMMessageDispatcher.java:86)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:110)
    at org.mule.transport.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:92)
    at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:75)
    at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2558)
    at org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor.process(OutboundResponsePropertiesMessageProcessor.java:39)
    at org.mule.processor.TransactionalInterceptingMessageProcessor$1.doInTransaction(TransactionalInterceptingMessageProcessor.java:49)
    at org.mule.processor.TransactionalInterceptingMessageProcessor$1.doInTransaction(TransactionalInterceptingMessageProcessor.java:46)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:110)
    at org.mule.processor.TransactionalInterceptingMessageProcessor.process(TransactionalInterceptingMessageProcessor.java:55)
    at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:41)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65)
    at org.mule.endpoint.DefaultOutboundEndpoint.process(DefaultOutboundEndpoint.java:88)
    at org.mule.module.client.MuleClient.send(MuleClient.java:643)
    at org.mule.module.client.MuleClient.send(MuleClient.java:619)
    at org.mule.module.client.MuleClient.send(MuleClient.java:570)
    at NpeTestCase$ClientRequest.run(NpeTestCase.java:58)
    Show
    Root Exception stack trace: java.lang.ArrayIndexOutOfBoundsException: 0 at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList.search(CopyOnWriteArrayList.java:68) at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:131) at edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet.add(CopyOnWriteArraySet.java:223) at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:57) at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:350) at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:90) at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:81) at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:113) at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:51) at org.mule.component.AbstractComponent$1.process(AbstractComponent.java:241) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.component.AbstractComponent.process(AbstractComponent.java:146) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.construct.AbstractFlowConstruct$1$1.process(AbstractFlowConstruct.java:103) at org.mule.processor.ExceptionHandlingMessageProcessor.process(ExceptionHandlingMessageProcessor.java:22) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:187) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:160) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:147) at org.mule.transport.vm.VMMessageReceiver.onCall(VMMessageReceiver.java:109) at org.mule.transport.vm.VMMessageDispatcher$1.doInTransaction(VMMessageDispatcher.java:89) at org.mule.transport.vm.VMMessageDispatcher$1.doInTransaction(VMMessageDispatcher.java:86) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:110) at org.mule.transport.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:92) at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:75) at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2558) at org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor.process(OutboundResponsePropertiesMessageProcessor.java:39) at org.mule.processor.TransactionalInterceptingMessageProcessor$1.doInTransaction(TransactionalInterceptingMessageProcessor.java:49) at org.mule.processor.TransactionalInterceptingMessageProcessor$1.doInTransaction(TransactionalInterceptingMessageProcessor.java:46) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:110) at org.mule.processor.TransactionalInterceptingMessageProcessor.process(TransactionalInterceptingMessageProcessor.java:55) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:41) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.processor.builder.InterceptingChainCompositeMessageProcessor.process(InterceptingChainCompositeMessageProcessor.java:65) at org.mule.endpoint.DefaultOutboundEndpoint.process(DefaultOutboundEndpoint.java:88) at org.mule.module.client.MuleClient.send(MuleClient.java:643) at org.mule.module.client.MuleClient.send(MuleClient.java:619) at org.mule.module.client.MuleClient.send(MuleClient.java:570) at NpeTestCase$ClientRequest.run(NpeTestCase.java:58)
  • Similar Issues:
    None

Description

The clear() method of the edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList is NOT synchronized (it should be). This causes a race condition in the Mule DefaultEntryPointResolverSet that leads to sporadic ArrayIndexOutOfBoundsExceptions.

Can be reprocuded with this FunctionalTestCase:

import org.mule.api.MuleException;
import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;
import org.mule.util.Base64;

import java.util.List;
import java.util.Random;

public class NpeTestCase extends FunctionalTestCase {

@Override
protected String getConfigResources() { return "npe-test-config.xml"; }

public void testMultithreaded() throws Exception {
final int numberOfThreads = 50;
final int requestCount = 100;
ClientRequest[] clients = new ClientRequest[numberOfThreads];
for (int i = 0; i < numberOfThreads; i++) { clients[i] = new ClientRequest(requestCount); }

for (ClientRequest clientRequest : clients) {
clientRequest.start();
try { Thread.sleep(5); } catch (InterruptedException ignored) {}
}

for (int i = 0; i < numberOfThreads; i++) {
try { clients[i].join(); } catch (InterruptedException ignored) {}
}
}

private class ClientRequest extends Thread {
final MuleClient client;
int requestCount;

private ClientRequest(final int requestCount) throws MuleException { client = new MuleClient(muleContext); this.requestCount = requestCount; }

@Override
public void run() {
final byte[] payload = createPayload();

while (--requestCount >= 0) {
try {
final MuleMessage outbound = client.send("inbound.sync", payload, null);
assertNull(outbound.getExceptionPayload());
assertNotNull(outbound.getPayload());
byte[] bytes = null;
if (outbound.getPayload() instanceof byte[]) { bytes = (byte[]) outbound.getPayload(); }
else if (outbound.getPayload() instanceof List) { final List list = (List)outbound.getPayload(); assertEquals(1, list.size()); assertTrue(list.get(0) instanceof byte[]); bytes = (byte[]) list.get(0); }
else { fail("unexpected payload type"); }
assertEquals(Base64.encodeBytes(payload), Base64.encodeBytes(bytes));
}
catch (Exception e) { fail("failed with exception: " + e); }
}
}

private byte[] createPayload() { Random random = new Random(); final int size = 55; byte[] payload = new byte[size]; random.nextBytes(payload); return payload; }
}
}

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Java Source File
    NpeTestCase.java
    25/Oct/10 05:18 AM
    3 kB
    achim pfefferle
  2. XML File
    npe-test-config.xml
    25/Oct/10 05:18 AM
    1.0 kB
    achim pfefferle

Issue Links

relates to

Bug - A problem which impairs or prevents the functions of the product. MULE-5178 Exceptions stored in DefaultEntryPointResolverSet not threadsafe

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
achim pfefferle added a comment - 25/Oct/10 05:18 AM

FunctionalTestCase and Mule configuration

Show
achim pfefferle added a comment - 25/Oct/10 05:18 AM FunctionalTestCase and Mule configuration
achim pfefferle made changes - 25/Oct/10 05:18 AM
Field Original Value New Value
Attachment npe-test-config.xml [ 13025 ]
Attachment NpeTestCase.java [ 13026 ]
Dirk Olmes made changes - 26/Oct/10 10:14 AM
Assignee Dirk Olmes [ dirk ]
Priority To be reviewed [ 6 ] Critical [ 2 ]
Mike Schilling made changes - 26/Oct/10 03:11 PM
Fix Version/s 3.0.1 [ 10877 ]
Mike Schilling made changes - 27/Oct/10 02:56 PM
Link This issue blocks BL-294 [ BL-294 ]
Dirk Olmes made changes - 02/Nov/10 04:34 PM
Status Open [ 1 ] In Progress [ 3 ]
Hide
Permalink
Dirk Olmes added a comment - 04/Nov/10 03:10 PM

3.0.x: http://fisheye.codehaus.org/changelog/mule/?cs=20074

Show
Dirk Olmes added a comment - 04/Nov/10 03:10 PM 3.0.x: http://fisheye.codehaus.org/changelog/mule/?cs=20074
Dirk Olmes made changes - 04/Nov/10 03:16 PM
Link This issue relates to MULE-5178 [ MULE-5178 ]
Dirk Olmes
05/Nov/10 02:37 AM
View full commit
Merged revisions 20073-20076 via svnmerge from https://svn.codehaus.org/mule/branches/mule-3.0.x ........ r20073 | dirk.olmes | 2010-11-04 20:42:34 +0100 (Thu, 04 Nov 2010) | 1 line open up access to testTimeoutSecs variable to allow overriding default in subclasses. ........ r20074 | dirk.olmes | 2010-11-04 21:09:49 +0100 (Thu, 04 Nov 2010) | 2 lines MULE-5161 (ArrayIndexOutOfBoundsException in CopyOnWriteArrayList): incorporate the test and fix the issue by using JDK's concurrent classes ........ r20075 | dirk.olmes | 2010-11-04 21:11:25 +0100 (Thu, 04 Nov 2010) | 1 line remove commented code ........ r20076 | dirk.olmes | 2010-11-04 21:18:16 +0100 (Thu, 04 Nov 2010) | 2 lines proper svn properties for the new test case ........ git-svn-id: https://svn.codehaus.org/mule/branches/mule-3.x@20082 bf997673-6b11-0410-b953-e057580c5b09
3.1.x
+3
-6
core/src/main/java/org/mule/model/resolvers/DefaultEntryPointResolverSet.java
+1
-1
core/src/test/java/org/mule/tck/AbstractMuleTestCase.java
Added
tests/integration/src/test/java/org/mule/test/integration/resolvers/DefaultEntryPointResolverSetMultithreadingTestCase.java
Added
tests/integration/src/test/resources/org/mule/test/integration/resolvers/default-entry-point-resolver-multithreading-test-config.xml
Hide
Permalink
Dirk Olmes added a comment - 05/Nov/10 02:41 AM

3.x: http://fisheye.codehaus.org/changelog/mule/?cs=20082

Show
Dirk Olmes added a comment - 05/Nov/10 02:41 AM 3.x: http://fisheye.codehaus.org/changelog/mule/?cs=20082
Dirk Olmes made changes - 05/Nov/10 02:52 AM
Status In Progress [ 3 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Transition Time In Source Status Execution Times Last Executer Last Execution Date
Open Open In Progress In Progress
8d 12h 31m 1 Dirk Olmes 02/Nov/10 04:34 PM
In Progress In Progress Closed Closed
2d 10h 18m 1 Dirk Olmes 05/Nov/10 02:52 AM
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
  • Repository mule on http://foo.bar/ failed: Error in remote call to 'FishEye 0 (http://foo.bar/)' (http://foo.bar) [AbstractRestCommand{path='/rest-service-fe/changeset-v1/listChangesets/', params={expand=changesets[-21:-1].revisions[0:29], comment=MULE-5161, p4JobFixed=MULE-5161, rep=mule}, methodType=GET}] : java.net.UnknownHostException: foo.bar

People

  • Assignee:
    Dirk Olmes
    Reporter:
    achim pfefferle
Vote (0)
Watch (1)

Dates

  • Created:
    25/Oct/10 04:02 AM
    Updated:
    05/Nov/10 02:52 AM
    Resolved:
    05/Nov/10 02:52 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.