[
https://issues.apache.org/jira/browse/CAMEL-28044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino reassigned CAMEL-28044:
----------------------------------------
Fix Version/s: 4.25.0
Assignee: Andrea Cosentino
> camel-google-storage: the consumer pages the whole bucket on every poll, and
> the Storage client is never closed
> ---------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-28044
> URL: https://issues.apache.org/jira/browse/CAMEL-28044
> Project: Camel
> Issue Type: Bug
> Components: camel-google-storage
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.25.0
>
>
> Found during an audit of the cloud components (camel-aws, camel-azure,
> camel-google, camel-huawei) at commit 7c0644752e17. Every item below was
> verified against the source.
> h4. 1. The consumer has no bound on what one poll returns
> {{GoogleCloudStorageConsumer.poll}} calls
> {{getStorageClient().list(bucketName)}} and then {{for (Blob blob :
> page.iterateAll())}} into a {{LinkedList}}, so every poll materialises the
> whole bucket (after an optional prefix) in memory before any filtering. The
> module declares no {{maxMessagesPerPoll}} anywhere, no page size, and no
> in-progress or idempotent repository. Its aws2-s3 counterpart has both a
> maxMessagesPerPoll and an in-progress repository. On a large bucket the first
> poll is a long, unbounded allocation.
> Proposed change: add maxMessagesPerPoll and cap the listing page size.
> h4. 2. The Storage client is never closed
> {{GoogleCloudStorageEndpoint}} creates the client in {{doStart()}} when the
> user did not supply one, but the class has no {{doStop()}} at all, so the
> transport channel is leaked on every route restart.
> {{com.google.cloud.storage.Storage}} extends {{AutoCloseable}} (verified on
> the pinned version). Every sibling closes under a "did we create it?" guard,
> for instance {{GoogleCloudVisionEndpoint}}: {{if (configuration.getClient()
> == null && visionClient != null)}}.
> Proposed change: add a doStop that closes the client only when the component
> created it.
> _Claude Code on behalf of oscerd_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)