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

camel-aws - aws-s3 - Thread leak in pollEnrich with dynamic uri

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Workaround
    • Affects Version/s: 2.19.2
    • Fix Version/s: 2.22.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      In a route we have this snippet:

      <pollEnrich>
       <simple>aws-s3://{{AWS_BUCKET_NAME_DOWNLOAD}}?amazonS3Client=#amazonS3Client&amp;deleteAfterRead=false&amp;prefix=${body.key}</simple>
      </pollEnrich>

      This is used to download one specific file from a bucket. Every time this is called, the endpoint URI changes because ${body.key} is constantly changing.

       

      In ScheduledPollConsumer we have this:

      public long beforePoll(long timeout) throws Exception {
       if (!ServiceHelper.resumeService(this)) {
       	ServiceHelper.startService(this);
       }
       return Math.max(timeout, getDelay());
      }
      
      public void afterPoll() throws Exception {
       if (!ServiceHelper.suspendService(this)) {
      	 ServiceHelper.stopService(this);
       }
      }
      

       

      Since S3Consumer is a Suspendable, the thread created by ServiceHelper.startService is never going to be killed, and since it's never going to be reused because we'll never have twice the same endpoint URI, eventually the application dies because of the rogue threads.

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              damien_b Damien B
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: