Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20103

DefaultProducerCache returns wrong ProducerTemplate under high concurrency load

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.2.0
    • 4.0.3, 4.3.0
    • camel-core
    • None
    • Patch Available
    • Unknown
    • Important

    Description

      as already posted on the dev mailing list the DefaultProducerCache can return a wrong ProducerTemplate under high concurrency load which leads to misrouted exchanges and therefor errors in the application and workflow.

       

      The improvement in the DefaultProducerCache from issue 19058 introduced a severe concurrency issue with that change

      While writing to the "lastUsed" fields in "acquireProducers" is synchronised, so that they are updated together, the read at the beginning of the method is not synchronised at all with the writes and therefor can be read at every time, even between the synced update to the fields which can lead to wrong producer templates being returned under high concurrency load. This then leads to exchanges being delivered to wrong endpoints causing severe malfunctions and errors.

       

      i have created a patch (and also a branch in my forked camel repo) including the fix and a unit test reproduces the problem with returning the wrong producer template for the requested endpoint when accessing from multiple threads

      Attachments

        1. patch.diff
          5 kB
          Peter Nowak

        Activity

          People

            orpiske Otavio Rodolfo Piske
            nukulami Peter Nowak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: