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

camel-aws2-sns: duplicate copies of configuration objects lead to undefined behavior

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.4, 3.6.0
    • 3.4.5, 3.7.0
    • camel-aws2
    • None
    • Unknown

    Description

      Camel is keeping 2 different instances of the configuration object for the AWS 2 SNS component. Subsequently, changes to the object instances cause both of them to be out of sync leading to undefined behavior depending on each copy is read.

      The problem flow is:

      1. A copy of the configuration object if created when instantiating the endpoint: https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L57
      2. The copy object is then set with additional configuration values, such as the topic and topicArn: https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L63-L66
      3. Then, when trying to set the component properties, the configuration object will be overwritten and the changes on step 2 may be lost: https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L69

       

      Under some circumstances, such as when using a custom configuration object this causes the code to overwrite the object.

      Here's a code snippet of the debug of the content of the parameters Map, used by setProperties to setup the endpoint. The introspection will eventually overwrite the configuration object.

       

      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: accessKey, Value: accesskey
      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: configuration, Value: #class:org.apache.camel.kafkaconnector.aws.v2.sns.sink.TestSnsConfiguration
      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: queueUrl, Value: http://localhost:35886/000000000000/ckcsns-608
      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: region, Value: us-east-1
      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: secretKey, Value: secretkey
      2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key: subscribeSNStoSQS, Value: true
      

       

       

       

       

       

       

       

       

       

      Attachments

        Issue Links

          Activity

            People

              orpiske Otavio Rodolfo Piske
              orpiske Otavio Rodolfo Piske
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: