qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siddhesh Poyarekar (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (QPID-3311) ConcurrentModificationException in java client during failover
Date Mon, 20 Jun 2011 05:21:47 GMT

     [ https://issues.apache.org/jira/browse/QPID-3311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Siddhesh Poyarekar updated QPID-3311:
-------------------------------------

    Attachment: qpid-java-safe-remove-sessions.patch

Safely remove sessions after iterating through the HashMap

The failover code to remove transacted sessions is not safe since it removes
elements from the HashMap when an iterator is running on it. Attached patch
records all sessions to be removed in a List and then removes all of them from
the HashMap after we're finished iterating through it.

> ConcurrentModificationException in java client during failover
> --------------------------------------------------------------
>
>                 Key: QPID-3311
>                 URL: https://issues.apache.org/jira/browse/QPID-3311
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Siddhesh Poyarekar
>         Attachments: TxSender.java, qpid-java-safe-remove-sessions.patch
>
>
> Description of problem:
> The java client removes transacted sessions during failover. This removal is
> not safe however, since it happens when the Hashmap of sessions is being
> iterated through. This occasionally results in a
> ConcurrentModificationException.
> How reproducible:
> Always
> Steps to Reproduce:
> 1. Run attached program
> Actual results:
> ERROR [IoReceiver - localhost/127.0.0.1:5672]
> (AMQConnectionDelegate_0_10.java:281) - error during failover
> java.util.ConcurrentModificationException
>  at java.util.HashMap$HashIterator.nextEntry(HashMap.java:810)
>  at java.util.HashMap$ValueIterator.next(HashMap.java:839)
>  at org.apache.qpid.transport.Connection.resume(Connection.java:469)
>  at
> org.apache.qpid.client.AMQConnectionDelegate_0_10.resubscribeSessions(AMQConnectionDelegate_0_10.java:221)
>  at
> org.apache.qpid.client.AMQConnection.resubscribeSessions(AMQConnection.java:1207)
>  at
> org.apache.qpid.client.AMQConnectionDelegate_0_10.closed(AMQConnectionDelegate_0_10.java:274)
>  at org.apache.qpid.transport.Connection.closed(Connection.java:561)
>  at org.apache.qpid.transport.network.Assembler.closed(Assembler.java:110)
>  at
> org.apache.qpid.transport.network.InputHandler.closed(InputHandler.java:202)
>  at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:150)
>  at java.lang.Thread.run(Thread.java:636)
> ERROR [IoReceiver - localhost/127.0.0.1:5672]
> (AMQConnectionDelegate_0_10.java:293) - connection exception: conn:3749eb9f
> org.apache.qpid.transport.ConnectionException: connection aborted
>  at org.apache.qpid.transport.Connection.closed(Connection.java:534)
>  at org.apache.qpid.transport.network.Assembler.closed(Assembler.java:110)
>  at
> org.apache.qpid.transport.network.InputHandler.closed(InputHandler.java:202)
>  at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:150)
>  at java.lang.Thread.run(Thread.java:636)
> Expected results:
> Successful failover
> Additional info:
> Logging options (log4j.properties):
> log4j.rootLogger=debug, stdout, R
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> # Pattern to output the caller's file name and line number.
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
> log4j.appender.R=org.apache.log4j.FileAppender
> log4j.appender.R.File=example.log
> log4j.appender.R.MaxFileSize=100000000KB
> # Keep one backup file
> log4j.appender.R.MaxBackupIndex=1
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.logger.org.apache=TRACE

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message