Benjamin Truitt created CAMEL-6097:
--------------------------------------

             Summary: Race condition in AggregatorProcessor recovery sometimes 
causes duplicates
                 Key: CAMEL-6097
                 URL: https://issues.apache.org/jira/browse/CAMEL-6097
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.9.2
            Reporter: Benjamin Truitt


There seems to be a race condition in 
org.apache.camel.processor.aggregate.AggregateProcessor's RecoverTask.  That 
task calls recoverable.scan() to find Exchanges that may need to be recovered. 
Since scan() might return Exchanges that are actually just in progress, the 
RecoverTask then checks to see if the Exchange really is in progress.  It does 
this by calling inProgressCompleteExchanges.contains(exchangeId).  However, 
that collection may have been modified during the time between when scan() 
returned and when contains() is called.  This would happen if the in-progress 
Exchange completes before contains() is called.  In that situation, inProgress 
would evaluate to false, so the Exchange would be recovered.  This results in a 
duplicate Exchange being output by the Aggregator component. 

One possible solution might be to prevent updating the 
inProgressCompleteExchanges during the critical section. Another possible 
solution might be to copy inProgressCompleteExchanges before calling scan().  
I'm sure that there are other ways to deal with this also.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to