activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "james strachan (JIRA)" <j...@apache.org>
Subject [jira] Moved: (AMQNET-18) Session 'consumers' hashtable susceptible to invalid operation exception
Date Tue, 27 Feb 2007 10:39:05 GMT

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

james strachan moved AMQ-930 to AMQNET-18:
------------------------------------------

        Fix Version/s:     (was: 4.1.0)
                       1.0
          Component/s:     (was: NMS (C# client))
    Affects Version/s:     (was: incubation)
                  Key: AMQNET-18  (was: AMQ-930)
              Project: ActiveMQ .Net  (was: ActiveMQ)

> Session 'consumers' hashtable susceptible to invalid operation exception
> ------------------------------------------------------------------------
>
>                 Key: AMQNET-18
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-18
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>         Environment: Windows XP, NMS API running against a AMQ 4.0.2 provider
>            Reporter: Bryan Schmidt
>             Fix For: 1.0
>
>
> In a multithreaded environment that reuses the Session object, the following exception
is thrown:
> Invalid operation exception with the text: "Collection was modified; enumeration operation
may not execute."
> The exception is thrown when iterating through Session's consumers.Values collection.
 It appears that the lock is being ignored.  Spinning up a new thread fixes the problem:
> --- Session.cs, DispatchAsyncMessages method ---
>         public void DispatchAsyncMessages(object state)
>         {
>             // lets iterate through each consumer created by this session
>             // ensuring that they have all pending messages dispatched
>             lock (this)
>             {
>                 // lets ensure that only 1 thread dispatches messages in a consumer at
once
>                 foreach (MessageConsumer consumer in consumers.Values)
>                 {
>                     ThreadPool.QueueUserWorkItem(new WaitCallback(consumer.DispatchAsyncMessages));
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message