You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "allthingssecurity (via GitHub)" <gi...@apache.org> on 2026/10/12 00:06:38 UTC

[PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

allthingssecurity opened a new pull request, #27697:
URL: https://github.com/apache/camel/pull/27697

   # Description
   
   [CAMEL-25558](https://issues.apache.org/jira/browse/CAMEL-25558)
   
   When the consumer lists the bucket, it adds each listed key to the `inProgressRepository` and then gets the object. If that get fails, the poll fails, and `createExchanges` removes the keys of the exchanges it has already created, but not the key of the object that failed, which has no exchange yet. That key stays in the repository (a memory repository that is only cleared when the endpoint stops), so every later poll skips it as "already in progress":
   
   - a listed object that was deleted before the get (another consumer on the bucket, a lifecycle rule, or the exchange of an earlier poll that completed after the listing) fails that poll with `NoSuchKeyException`. The other listed objects are consumed by a following poll, but a new object that is later stored under the same key is never consumed;
   - an object whose get fails for another reason (access denied, throttling, a network error), or whose download fails with `includeBody=true`, fails that poll in the same way, stays in the bucket, and is never consumed again, until the endpoint is restarted.
   
   This is not new and does not come from CAMEL-25521: camel-4.22.x has the same loop and catch block. I found it while comparing this consumer with the other object storage consumers after CAMEL-25521 (#27672).
   
   The change, for the listing only:
   
   - a failure to get one listed object, or to create its exchange (download of the body, `includeS3Object`), no longer fails the poll. The object is skipped: its stream is closed, its exchange is given back to the exchange factory, and its key is removed from the in-progress repository. The other listed objects are consumed in the same poll, and a later poll tries the skipped object again;
   - `NoSuchKeyException` is logged at DEBUG, as camel-minio (CAMEL-25512) and camel-google-storage (CAMEL-25519) do for an object that no longer exists. Any other failure is logged at WARN with the key and the exception message, without a stack trace, as camel-ibm-cos does for any failed get (it skips the object and continues). An object that can never be read (archived, access denied) gives one such line at every poll that lists it;
   - a skipped object is not counted in the polled messages or in `CamelBatchSize`;
   - the body of `createExchange(ExchangePattern, ResponseInputStream, String)` moved to a private `populateExchange`, so that the exchange is given back when filling it fails (this also covers the `fileName` poll). With the pooled exchange factory it is given back with `done()`: `releaseExchange(exchange, true)` on an exchange that is not done puts it in the pool twice (release, `done()`, the on-done task, release again), and two later objects of the same poll then share one exchange. The pooled test below fails in that way with `releaseExchange`. The same call for exchanges that are never routed exists on main in this consumer (`processBatch` when stopping, and the outer catch) and in other consumers; I did not change those here;
   - the WARN of the remaining outer catch (now only reached when the in-progress repository itself fails) no longer ends with "This exception is ignored.", as the exception is rethrown.
   
   **Decision for the reviewer.** Skip-and-continue for a failed get was chosen to match camel-ibm-cos, and so that one object that cannot be read does not block the bucket: once the key is no longer left in progress, failing the poll would fail every poll for such an object, and the objects listed after it would never be consumed. The cost is that such a failure is no longer a failed poll: it does not reach the exception handler (or the route with `bridgeErrorHandler=true`), does not count for `backoffErrorThreshold`, and when S3 cannot be reached at all each listed object is tried and logged (at most `maxMessagesPerPoll` per poll, 10 by default). If you prefer to keep failing the poll and only remove the key, it is a one-line change (rethrow in the second catch).
   
   The listing marker: it is taken from the listing response before the objects are got, as before, and a skipped object does not move it back. When the listing is not truncated, the next poll lists from the start and tries the object again. When it is truncated (more objects than `maxMessagesPerPoll`), the following polls continue with the next pages, and the skipped object is tried again when the listing starts over. `maxMessagesPerPoll` still limits the listing, so a poll with a skipped object routes fewer messages.
   
   Not changed, and known limits:
   
   - with `fileName`, a failed get still fails the poll (there is nothing else to consume), and its key is removed as before;
   - an `Error` (for example `OutOfMemoryError` while a large object is read into the body) is not caught, so its key still stays in progress.
   
   4.23 upgrade-guide note under the existing "camel-aws2-s3 - objects in progress in the consumer" entry.
   
   Tests, with the in-process `FakeS3Server` of the module (it can now remove an object right after it was listed, refuse the gets of an object with 403 until told otherwise, and cut the body of a get short). The scheduler is not started and the tests call `poll()`; there is no waiting. `AWS2S3ConsumerDeletedObjectTest` (6 tests), and `AWS2S3ConsumerDeletedObjectPooledExchangeTest`, which runs the same 6 with `PooledExchangeFactory` and adds one. All 13 fail without the change in `AWS2S3Consumer`:
   
   - `listedObjectThatNoLongerExistsIsSkipped`: `b.txt` is removed after the listing; the poll returns 2 and routes `a.txt` and `c.txt` with `CamelBatchSize` 2. Without the change: `NoSuchKeyException` from `poll()`.
   - `objectCreatedAgainAfterItWasSkippedIsConsumed` (`includeBody=false`): a new `b.txt` is consumed by the next poll. Without the change: `NoSuchKeyException` from the first poll.
   - `objectWhoseGetIsRefusedDoesNotStopTheOtherObjects`: every get of `b.txt` is refused (403). The poll returns 2 (`a.txt`, `c.txt`), the next poll consumes a new `d.txt` and tries `b.txt` again, and `b.txt` is consumed once its get is allowed. Without the change: `S3Exception` (Access Denied) from the first `poll()`.
   - `skippedObjectOfATruncatedListingIsTriedAgainWhenTheListingStartsOver` (`maxMessagesPerPoll=2`, four objects): the first poll returns 1, the second consumes the second page without trying `b.txt`, the third starts over and tries it again. Without the change: `S3Exception` from the first `poll()`.
   - `objectWhoseDownloadFailsIsSkippedAndNotLeftInProgress`: the content stream fails while it is read into the body; the poll returns 0, the stream is closed and the key removed. Without the change: `RuntimeCamelException` (`IOException: connection reset`) from `poll()`.
   - `objectStreamIsClosedWhenIncludeS3ObjectFails`: an overridden `includeS3Object` throws; the poll returns 0, the stream is closed and the key removed. Without the change: `IllegalStateException` from `poll()`.
   - `exchangeOfAnObjectWhoseDownloadFailsIsGivenBackToThePool` (pooled only): the body of `b.txt` is cut short; `a.txt`, `c.txt` and `d.txt` are routed with their own bodies, and the pool statistics show 4 exchanges taken and 4 released, none discarded. Without the change: `RuntimeCamelException` (`ConnectionClosedException: Premature end of Content-Length delimited message body`) from `poll()`.
   - With the change, the camel-aws2-s3 unit tests pass (98; the 68 integration tests need LocalStack and were skipped).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
     (The issue is drafted and not filed yet: `CAMEL-25558` above is a placeholder.)
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes.
     (I built and tested camel-aws2-s3, including the formatter and import-sort plugins; the build did not change any generated file. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6120395535

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-aws/camel-aws2-s3`
   - `docs`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 10 of 704 tested, 26 compile-only — current: 10 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **10 affected modules** (current approach: 10).
   
   **Skip-tests mode would test 10 modules** (2 direct + 9 downstream), **skip tests for 26** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (10)</summary>
   
   - `camel-aws2-eventbridge` ← downstream of org.apache.camel:camel-aws2-s3
   - `camel-aws2-s3` ← components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java, components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWS2S3ConsumerDeletedObjectPooledExchangeTest.java, components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWS2S3ConsumerDeletedObjectTest.java, components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/FakeS3Server.java
   - `camel-jbang-mcp` ← downstream of org.apache.camel:camel-yaml-dsl
   - `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-route-parser
   - `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   - `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
   - `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-yaml-dsl
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   
   </details>
   
   <details><summary>Modules with tests skipped (26)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (37 modules, 5m 23s total)</summary>
   
   **Total reactor time:** 5m 23s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Launcher | 46.4s | SUCCESS |
   | Camel :: JBang :: MCP | 41.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 28.7s | SUCCESS |
   | Camel :: Catalog :: Camel Catalog | 24.4s | SUCCESS |
   | Camel :: Component DSL | 20.2s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 20.0s | SUCCESS |
   | Camel :: YAML DSL | 19.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 16.7s | SUCCESS |
   | Camel :: Docs | 16.2s | SUCCESS |
   | Camel :: AWS2 Eventbridge | 12.2s | SUCCESS |
   | Camel :: Kamelet Main | 12.1s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 8.7s | SUCCESS |
   | Camel :: Catalog :: Camel Route Parser | 7.9s | SUCCESS |
   | Camel :: YAML DSL :: Deserializers | 7.8s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 7.0s | SUCCESS |
   | Camel :: Catalog :: Camel Report Maven Plugin | 6.4s | SUCCESS |
   | Camel :: All Components Sync point | 4.8s | SUCCESS |
   | Camel :: Catalog :: Maven | 3.4s | SUCCESS |
   | Camel :: Catalog :: Suggest (deprecated) | 3.3s | SUCCESS |
   | Camel :: YAML DSL :: Maven Plugins | 2.8s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.8s | SUCCESS |
   | Camel :: Assembly | 1.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.3s | SUCCESS |
   | Camel :: Coverage | 1.3s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.2s | SUCCESS |
   | Camel :: Endpoint DSL :: Support | 1.1s | SUCCESS |
   | Camel :: Catalog :: Dummy Component | 0.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 0.8s | SUCCESS |
   | Camel :: Catalog :: Console | 0.8s | SUCCESS |
   | Camel :: Launcher :: Container | 0.7s | SUCCESS |
   | Camel :: JBang :: Main | 0.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: Route Parser | 0.5s | SUCCESS |
   | Camel :: AWS2 S3 | n/a |  |
   | Camel :: Endpoint DSL | n/a |  |
   | Camel :: Integration Tests | n/a |  |
   | Camel :: JBang :: Core | n/a |  |
   | Camel :: JBang :: Plugin :: TUI | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: Launcher` (46.4s)
   - `Camel :: JBang :: MCP` (41.9s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (28.7s)
   - `Camel :: Catalog :: Camel Catalog` (24.4s)
   - `Camel :: Component DSL` (20.2s)
   - `Camel :: YAML DSL :: Validator` (20.0s)
   - `Camel :: YAML DSL` (19.9s)
   - `Camel :: JBang :: Plugin :: Validate` (16.7s)
   - `Camel :: Docs` (16.2s)
   - `Camel :: AWS2 Eventbridge` (12.2s)
   - `Camel :: Kamelet Main` (12.1s)
   - `Camel :: JBang :: Plugin :: Testing` (8.7s)
   - `Camel :: Catalog :: Camel Route Parser` (7.9s)
   - `Camel :: YAML DSL :: Deserializers` (7.8s)
   - `Camel :: YAML DSL :: Validator Maven Plugin` (7.0s)
   - `Camel :: Catalog :: Camel Report Maven Plugin` (6.4s)
   - `Camel :: All Components Sync point` (4.8s)
   - `Camel :: Catalog :: Maven` (3.4s)
   - `Camel :: Catalog :: Suggest (deprecated)` (3.3s)
   - `Camel :: YAML DSL :: Maven Plugins` (2.8s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38186764136)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6132352508

   ✅ Backport to `camel-4.22.x` created: https://github.com/apache/camel/pull/27749


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4245538867


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java:
##########
@@ -283,23 +284,36 @@ protected Queue<Exchange> createExchanges(List<S3Object> s3ObjectSummaries) {
                         getRequest.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
                     }
                 }
-                ResponseInputStream<GetObjectResponse> s3Object
-                        = getAmazonS3Client().getObject(getRequest.build(), ResponseTransformer.toInputStream());
-
-                if (includeS3Object(s3Object)) {
-                    s3Objects.add(s3Object);
-                    Exchange exchange = createExchange(s3Object, key);
-                    answer.add(exchange);
-                } else {
-                    // If includeFolders != true and the object is not included, it is safe to close the object here.
-                    // If includeFolders == true, the exchange will close the object.
-                    IOHelper.close(s3Object);
-                    // remove in progress
-                    getEndpoint().getInProgressRepository().remove(key);
+                // a failure to get one listed object, or to create its exchange, does not fail the poll: the object is
+                // skipped, the other listed objects are consumed, and a later poll tries it again
+                ResponseInputStream<GetObjectResponse> s3Object = null;
+                try {
+                    s3Object = getAmazonS3Client().getObject(getRequest.build(), ResponseTransformer.toInputStream());
+                    if (includeS3Object(s3Object)) {
+                        Exchange exchange = createExchange(s3Object, key);
+                        s3Objects.add(s3Object);
+                        answer.add(exchange);
+                    } else {
+                        // If includeFolders != true and the object is not included, it is safe to close the object
+                        // here. If includeFolders == true, the exchange will close the object.
+                        IOHelper.close(s3Object);
+                        // remove in progress
+                        getEndpoint().getInProgressRepository().remove(key);
+                    }
+                } catch (NoSuchKeyException e) {
+                    // deleted after it was listed (by another consumer, a lifecycle rule, or the exchange of an
+                    // earlier poll that completed meanwhile)
+                    LOG.debug("Skipping as s3 object no longer exists: {}", key);
+                    skipS3Object(s3Object, key);
+                } catch (Exception e) {
+                    // no stack trace: an object that cannot be got (archived, access denied) is logged at every poll
+                    LOG.warn("Error getting S3Object {} from bucket {} due: {}. Skipping it for this poll.", key,

Review Comment:
   This consumer already has a skip-and-continue pattern in `processCommit`: `getExceptionHandler().handleException("... This exception is ignored.", e)`. Using it here keeps the skip, but lets users who route consumer errors (`bridgeErrorHandler`, a custom `exceptionHandler`) see the failure. With the default `LoggingExceptionHandler` the cost is a WARN with a stack trace, as before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6125049997

   Rebased on `main` (d2c534504f4f): the 4.24 upgrade guide is on main now, so the only conflict was that file, and this PR's section is kept after the existing one. The code is unchanged from the reviewed commits.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6131637962

   Conflict in the 4.24 upgrade guide resolved again (57bc702d3088); the code is unchanged.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4245774550


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java:
##########
@@ -283,23 +284,36 @@ protected Queue<Exchange> createExchanges(List<S3Object> s3ObjectSummaries) {
                         getRequest.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
                     }
                 }
-                ResponseInputStream<GetObjectResponse> s3Object
-                        = getAmazonS3Client().getObject(getRequest.build(), ResponseTransformer.toInputStream());
-
-                if (includeS3Object(s3Object)) {
-                    s3Objects.add(s3Object);
-                    Exchange exchange = createExchange(s3Object, key);
-                    answer.add(exchange);
-                } else {
-                    // If includeFolders != true and the object is not included, it is safe to close the object here.
-                    // If includeFolders == true, the exchange will close the object.
-                    IOHelper.close(s3Object);
-                    // remove in progress
-                    getEndpoint().getInProgressRepository().remove(key);
+                // a failure to get one listed object, or to create its exchange, does not fail the poll: the object is
+                // skipped, the other listed objects are consumed, and a later poll tries it again
+                ResponseInputStream<GetObjectResponse> s3Object = null;
+                try {
+                    s3Object = getAmazonS3Client().getObject(getRequest.build(), ResponseTransformer.toInputStream());
+                    if (includeS3Object(s3Object)) {
+                        Exchange exchange = createExchange(s3Object, key);
+                        s3Objects.add(s3Object);
+                        answer.add(exchange);
+                    } else {
+                        // If includeFolders != true and the object is not included, it is safe to close the object
+                        // here. If includeFolders == true, the exchange will close the object.
+                        IOHelper.close(s3Object);
+                        // remove in progress
+                        getEndpoint().getInProgressRepository().remove(key);
+                    }
+                } catch (NoSuchKeyException e) {
+                    // deleted after it was listed (by another consumer, a lifecycle rule, or the exchange of an
+                    // earlier poll that completed meanwhile)
+                    LOG.debug("Skipping as s3 object no longer exists: {}", key);
+                    skipS3Object(s3Object, key);
+                } catch (Exception e) {
+                    // no stack trace: an object that cannot be got (archived, access denied) is logged at every poll
+                    LOG.warn("Error getting S3Object {} from bucket {} due: {}. Skipping it for this poll.", key,

Review Comment:
   Done in d676411892a9. A listed object that is skipped for another reason than `NoSuchKeyException` is now given to
   `getExceptionHandler().handleException("Error getting S3Object <key> from bucket <bucket>. The object is skipped for
   this poll. This exception is ignored.", e)`, as `processCommit` does. `NoSuchKeyException` stays at DEBUG. Tests:
   `objectWhoseGetIsRefusedDoesNotStopTheOtherObjects` sets a recording exception handler and gets one `S3Exception`
   (403) with the key in the message; `failureOfASkippedObjectIsRoutedWithBridgeErrorHandler` gets one exchange at
   `onException(S3Exception.class)`. Both fail on the previous commit. The upgrade-guide note is updated.
   
   _Claude Code on behalf of allthingssecurity_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27697:
URL: https://github.com/apache/camel/pull/27697


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4245846940


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java:
##########
@@ -315,9 +336,38 @@ protected Queue<Exchange> createExchanges(List<S3Object> s3ObjectSummaries) {
             throw e;
         }
 
+        if (!failures.isEmpty()) {
+            if (!anyGot) {
+                // none of the listed objects could be got, so this is not about one object (expired credentials, no
+                // permission to get, throttling, no connection): the poll fails as it does when the listing fails, and
+                // the error handling and the backoff of the scheduled consumer apply
+                Map.Entry<String, RuntimeException> first = failures.entrySet().iterator().next();
+                LOG.warn("None of the listed objects of bucket {} could be got ({} failed, the first is {}): the poll fails",
+                        getConfiguration().getBucketName(), failures.size(), first.getKey());
+                throw first.getValue();
+            }
+            // as processCommit does: the consumer goes on, and a custom exception handler or bridgeErrorHandler sees
+            // the failure
+            for (Map.Entry<String, RuntimeException> failure : failures.entrySet()) {
+                String message = "Error getting S3Object " + failure.getKey() + " from bucket "
+                                 + getConfiguration().getBucketName()
+                                 + ". The object is skipped for this poll. This exception is ignored.";

Review Comment:
   💡 **Minor / Convention:** `"This exception is ignored."` is the established pattern (matching `processCommit`), and the author explicitly followed it. That said, when `bridgeErrorHandler=true` or a custom `ExceptionHandler` is wired, the exception is actually **routed** — not ignored. A more precise phrasing like `"...handled by the configured exception handler."` would avoid operator confusion, but changing it deviates from the existing convention. Leaving to author's judgment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6121243692

   `camel-4.23.x` is branched, so df045ca8593b moves the upgrade-guide note out of `camel-4x-upgrade-guide-4_23.adoc`
   into a new `camel-4x-upgrade-guide-4_24.adoc` under `== Upgrading Camel 4.23 to 4.24`, with its own heading
   `=== camel-aws2-s3 - a listed object that cannot be fetched is skipped` (created with the same header as the 4_23
   guide), and adds `- xref:camel-4x-upgrade-guide-4_24.adoc[Upgrade guide 4.23 -> 4.24]` to
   `camel-4x-upgrade-guide.adoc`. The header and the list line are the same as in #27689, #27690, #27691, #27692, #27695
   and #27696, so whichever is merged later only has to keep both sections.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6119658458

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6120109946

   1. Agreed, #27698 first. The two `releaseExchange(exchange, true)` calls for exchanges that are never routed are the
      ones main already has; no change here. The new call in `createExchange` uses `done()` for a pooled exchange, which
      puts it into the pool once with and without #27698, so I left it.
   2. Done in d676411892a9 (inline reply).
   3. Not intended. d676411892a9 adds a rule: when the listing returned objects, at least one get failed with something
      other than `NoSuchKeyException`, and S3 answered the get of none of the listed objects, the poll fails with the
      failure of the first object (all keys are removed from the in-progress repository first, and the failures are not
      reported per object as well). So expired credentials, a missing `s3:GetObject` permission or throttling between
      the listing and the gets are failed polls and count for `backoffErrorThreshold`; one object that cannot be read
      among others that can is skipped as before. I did not classify by status code, because the same code can be about
      one object or about everything. Consequences, also in the PR description: a bucket that holds only unreadable
      objects fails every poll, and every listed object of the poll is tried before it fails. Test:
      `pollFailsWhenNoneOfTheListedObjectsCouldBeGot` (both gets refused: `poll()` throws the `S3Exception`, no key is
      left in progress, the next poll consumes both once the gets are allowed); it fails on the previous commit.
      If you prefer another rule, I will change it.
   4. main is still 4.23.0-SNAPSHOT and has no `camel-4x-upgrade-guide-4_24.adoc` yet (checked on origin/main today),
      so the note is still in the 4_23 guide. I will move it to the 4_24 guide as soon as that file exists; it can stay
      where it is if the fix goes to `camel-4.23.x` as well.
   5. The PR description no longer calls CAMEL-25558 a placeholder.
   
   camel-aws2-s3 after the commit: 104 tests, 0 failures.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4249691125


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -27,3 +27,21 @@ A `hashicorp:` property with a field of a secret that does not exist, such as `{
 now resolves to no value, as it already did without a field, so its default value or an optional placeholder
 (`{{?hashicorp:secret:missing#field}}`) applies. Before, without a default value, it failed with a
 `NullPointerException`.
+
+=== camel-aws2-s3 - a listed object that cannot be fetched is skipped

Review Comment:
   Added in aa5ac293013e (docs only): the same note, with the same `=== camel-aws2-s3 - a listed object that cannot be
   fetched is skipped` heading, is now also in `camel-4x-upgrade-guide-4_22.adoc` at the end of
   `== Upgrading from 4.22.1 to 4.22.2`. The text is identical to the 4.24 note.
   
   The last paragraph of the PR description is corrected too: the 4.24 guide and its index line are on main, this PR
   only appends its section, and it now also mentions the 4.22 note.
   
   _Claude Code on behalf of allthingssecurity_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4249464326


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -27,3 +27,21 @@ A `hashicorp:` property with a field of a secret that does not exist, such as `{
 now resolves to no value, as it already did without a field, so its default value or an optional placeholder
 (`{{?hashicorp:secret:missing#field}}`) applies. Before, without a default value, it failed with a
 `NullPointerException`.
+
+=== camel-aws2-s3 - a listed object that cannot be fetched is skipped

Review Comment:
   Since this PR has the `port/camel-4.22.x` label, please also add this section to `camel-4x-upgrade-guide-4_22.adoc` on main, under `== Upgrading from 4.22.1 to 4.22.2`. You can do it here or in a follow-up doc-sync PR. Otherwise the 4.22 guide on main will not mention a change that ships in 4.22.2. For 4.22.2 the "With the `fileName` option ..." part and the rest of the note read the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6130241526

   @davsclaus resolved again (6b98d2bbb271): only `camel-4x-upgrade-guide-4_24.adoc` conflicted, all sections of main are kept and this PR's section follows them; the code is unchanged. Each merge of one of these PRs makes the others conflict in that one file again; I re-resolve them within minutes of every merge.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6131948577

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   **Conflicts (🤖 agent dispatched to resolve):**
   - âš ī¸ `camel-4.22.x` — Cherry-pick conflict in: components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/FakeS3Server.java
   
   â„šī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on PR #27697:
URL: https://github.com/apache/camel/pull/27697#issuecomment-6129561567

   Conflict resolved (28e9d58f5e23, merged `main` into the branch): the only conflicting file was `camel-4x-upgrade-guide-4_24.adoc`, where other PRs had added sections; they are all kept and this PR's section follows them. The code is unchanged from the approved commits.
   
   _Claude Code on behalf of allthingssecurity_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25558: camel-aws2-s3 - A listed object that cannot be fetched no longer blocks the consumer or stays in progress [camel]

Posted by "allthingssecurity (via GitHub)" <gi...@apache.org>.
allthingssecurity commented on code in PR #27697:
URL: https://github.com/apache/camel/pull/27697#discussion_r4246364647


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java:
##########
@@ -315,9 +336,38 @@ protected Queue<Exchange> createExchanges(List<S3Object> s3ObjectSummaries) {
             throw e;
         }
 
+        if (!failures.isEmpty()) {
+            if (!anyGot) {
+                // none of the listed objects could be got, so this is not about one object (expired credentials, no
+                // permission to get, throttling, no connection): the poll fails as it does when the listing fails, and
+                // the error handling and the backoff of the scheduled consumer apply
+                Map.Entry<String, RuntimeException> first = failures.entrySet().iterator().next();
+                LOG.warn("None of the listed objects of bucket {} could be got ({} failed, the first is {}): the poll fails",
+                        getConfiguration().getBucketName(), failures.size(), first.getKey());
+                throw first.getValue();
+            }
+            // as processCommit does: the consumer goes on, and a custom exception handler or bridgeErrorHandler sees
+            // the failure
+            for (Map.Entry<String, RuntimeException> failure : failures.entrySet()) {
+                String message = "Error getting S3Object " + failure.getKey() + " from bucket "
+                                 + getConfiguration().getBucketName()
+                                 + ". The object is skipped for this poll. This exception is ignored.";

Review Comment:
   Changed in df045ca8593b. The message given to the exception handler for a skipped object is now
   `Error getting S3Object <key> from bucket <bucket>. The object is skipped for this poll.`, without
   "This exception is ignored.". That is true in all three cases (default `LoggingExceptionHandler`,
   `bridgeErrorHandler=true`, custom `exceptionHandler`). The upgrade-guide note no longer calls it an ignored exception
   either. I left the `processCommit` message as it is, since it is not part of this change. No test asserts the
   sentence; camel-aws2-s3 unit tests: 104 tests, 0 failures.
   
   _Claude Code on behalf of allthingssecurity_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org