You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/09/16 08:13:13 UTC
[PR] CAMEL-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
oscerd opened a new pull request, #26495:
URL: https://github.com/apache/camel/pull/26495
## Issue
[CAMEL-24764](https://issues.apache.org/jira/browse/CAMEL-24764)
## Problem & Fix
Gap audit of camel-huaweicloud-obs found several functional issues, all verified against main:
- **Connection leak (HIGH)** — `OBSUtils.mapObsObject` read the object content via `IOHelper.copy`, which does not close its input, so the Huawei SDK content stream (which holds a pooled HTTP connection) leaked on every producer `getObject` and every consumer-polled object → connection-pool exhaustion on a long-running consumer. Now read inside try-with-resources.
- **putObject can't auto-create a bucket without `bucketLocation`** — the create-if-missing path skipped the `DEFAULT_LOCATION` default that `createBucket` applies, so it failed with a confusing empty-regionId error. Now mirrors `createBucket`.
- **String upload charset** — a `String` body was uploaded with the platform-default charset; now UTF-8.
- **Debug log** — the getObject download log printed the bucket location instead of the bucket name.
- **Proxy guard** — `isNotEmpty(getProxyPort())` on a primitive `int` is always true, so `proxyHost` with no `proxyPort` configured a proxy on port 0; now requires `getProxyPort() > 0`.
## Testing
- New `GetObjectTest.testGetObjectClosesContentStream` asserts the object content stream is closed after a download (guards the leak fix).
- Full `camel-huaweicloud-obs` unit suite green.
- `mvn -Psourcecheck validate` green.
🤖 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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #26495:
URL: https://github.com/apache/camel/pull/26495
--
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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26495:
URL: https://github.com/apache/camel/pull/26495#issuecomment-5710992950
<!-- camel-backport-bot -->
### 🔄 Backport Bot
**Conflicts (🤖 agent dispatched to resolve):**
- ⚠️ `camel-4.22.x` — Command failed: gh pr create --repo apache/camel --base camel-4.22.x --head gnodet-bot:backport/26495-to-camel-4.22.x --title [backport camel-4.22.x] CAMEL-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues --body <!-- camel-backport-bot -->
## Backport of #26495
Cherry-pick of #26495 onto `camel-4.22.x`.
**Original PR:** #26495 - CAMEL-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues
**Original author:** @oscerd
**Target branch:** `camel-4.22.x`
--label backport,components --assignee oscerd
pull request update failed: GraphQL: gnodet-bot does not have permission to update the pull request PR_kwDOAAMl7c8AAAABD5BXLw. (updatePullRequest)
- ⚠️ `camel-4.18.x` — Command failed: gh pr create --repo apache/camel --base camel-4.18.x --head gnodet-bot:backport/26495-to-camel-4.18.x --title [backport camel-4.18.x] CAMEL-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues --body <!-- camel-backport-bot -->
## Backport of #26495
Cherry-pick of #26495 onto `camel-4.18.x`.
**Original PR:** #26495 - CAMEL-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues
**Original author:** @oscerd
**Target branch:** `camel-4.18.x`
--label backport,components --assignee oscerd
pull request update failed: GraphQL: gnodet-bot does not have permission to update the pull request PR_kwDOAAMl7c8AAAABD5Bf3w. (updatePullRequest)
ℹ️ 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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26495:
URL: https://github.com/apache/camel/pull/26495#issuecomment-5694676249
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `components/camel-huawei/camel-huaweicloud-obs`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 9 tested, 27 compile-only — current: 9 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **36 affected modules** (current approach: 9).
<details><summary>:warning: Modules only in Scalpel (27)</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`
- `docs`
- `dummy-component`
</details>
**Skip-tests mode would test 9 modules** (1 direct + 8 downstream), **skip tests for 27** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (9)</summary>
- `camel-huaweicloud-obs`
- `camel-jbang-mcp`
- `camel-jbang-plugin-mcp`
- `camel-jbang-plugin-route-parser`
- `camel-jbang-plugin-tui`
- `camel-jbang-plugin-validate`
- `camel-launcher-container`
- `camel-yaml-dsl-validator`
- `camel-yaml-dsl-validator-maven-plugin`
</details>
<details><summary>Modules with tests skipped (27)</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`
- `docs`
- `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 (36 modules, 4m 20s total)</summary>
**Total reactor time:** 4m 20s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 47.5s | SUCCESS |
| Camel :: JBang :: MCP | 37.0s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | 27.6s | SUCCESS |
| Camel :: Component DSL | 18.1s | SUCCESS |
| Camel :: Catalog :: Camel Catalog | 17.6s | SUCCESS |
| Camel :: Docs | 13.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 12.2s | SUCCESS |
| Camel :: Huawei Cloud :: OBS | 11.1s | SUCCESS |
| Camel :: Catalog :: Camel Report Maven Plugin | 8.1s | SUCCESS |
| Camel :: Catalog :: Camel Route Parser | 7.8s | SUCCESS |
| Camel :: Kamelet Main | 7.7s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 7.2s | SUCCESS |
| Camel :: YAML DSL :: Validator | 6.5s | SUCCESS |
| Camel :: YAML DSL :: Deserializers | 5.9s | SUCCESS |
| Camel :: All Components Sync point | 4.6s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 4.4s | SUCCESS |
| Camel :: YAML DSL :: Maven Plugins | 3.4s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 3.3s | SUCCESS |
| Camel :: Assembly | 2.0s | SUCCESS |
| Camel :: Catalog :: Suggest (deprecated) | 1.9s | SUCCESS |
| Camel :: Catalog :: Maven | 1.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.3s | SUCCESS |
| Camel :: Coverage | 1.2s | SUCCESS |
| Camel :: Catalog :: Dummy Component | 1.2s | SUCCESS |
| Camel :: Catalog :: Console | 1.0s | SUCCESS |
| Camel :: JBang :: Main | 1.0s | SUCCESS |
| Camel :: Endpoint DSL :: Support | 0.9s | SUCCESS |
| Camel :: JBang :: Integration tests | 0.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 0.9s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 0.8s | SUCCESS |
| Camel :: Launcher :: Container | 0.6s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.6s | SUCCESS |
| Camel :: Endpoint DSL | n/a | |
| Camel :: Integration Tests | n/a | |
| Camel :: JBang :: Core | n/a | |
| Camel :: YAML DSL | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (47.5s)
- `Camel :: JBang :: MCP` (37.0s)
- `Camel :: JBang :: Plugin :: TUI` (27.6s)
- `Camel :: Component DSL` (18.1s)
- `Camel :: Catalog :: Camel Catalog` (17.6s)
- `Camel :: Docs` (13.8s)
- `Camel :: JBang :: Plugin :: Kubernetes` (12.2s)
- `Camel :: Huawei Cloud :: OBS` (11.1s)
- `Camel :: Catalog :: Camel Report Maven Plugin` (8.1s)
- `Camel :: Catalog :: Camel Route Parser` (7.8s)
- `Camel :: Kamelet Main` (7.7s)
- `Camel :: JBang :: Plugin :: Testing` (7.2s)
- `Camel :: YAML DSL :: Validator` (6.5s)
- `Camel :: YAML DSL :: Deserializers` (5.9s)
- `Camel :: All Components Sync point` (4.6s)
- `Camel :: JBang :: Plugin :: Validate` (4.4s)
- `Camel :: YAML DSL :: Maven Plugins` (3.4s)
- `Camel :: YAML DSL :: Validator Maven Plugin` (3.3s)
- `Camel :: Assembly` (2.0s)
- `Camel :: Catalog :: Suggest (deprecated)` (1.9s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/35072585580)
--
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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #26495:
URL: https://github.com/apache/camel/pull/26495#discussion_r4034146076
##########
components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSProducer.java:
##########
@@ -153,7 +159,7 @@ private void putObject(Exchange exchange, ClientConfigurations clientConfigurati
} else if (body instanceof String) {
// the string content will be stored in the remote object
LOG.trace("Writing text body into an object");
- InputStream stream = new ByteArrayInputStream(((String) body).getBytes());
+ InputStream stream = new ByteArrayInputStream(((String) body).getBytes(StandardCharsets.UTF_8));
putObjectResult = obsClient.putObject(clientConfigurations.getBucketName(),
clientConfigurations.getObjectName(), stream);
stream.close();
Review Comment:
Done in the follow-up commit — the ByteArrayInputStream is now in try-with-resources for consistency with the OBSUtils download path. As you noted its close() is a no-op, so there is no behavioural change.
_Claude Code on behalf of oscerd_
--
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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on PR #26495:
URL: https://github.com/apache/camel/pull/26495#issuecomment-5711050659
<!-- camel-backport-bot -->
### 🔄 Backport Bot
**Port PRs updated:**
- 🔄 `camel-4.22.x` → #26539 (force-pushed)
- 🔄 `camel-4.18.x` → #26540 (force-pushed)
ℹ️ 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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26495:
URL: https://github.com/apache/camel/pull/26495#discussion_r4023929117
##########
components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSProducer.java:
##########
@@ -153,7 +159,7 @@ private void putObject(Exchange exchange, ClientConfigurations clientConfigurati
} else if (body instanceof String) {
// the string content will be stored in the remote object
LOG.trace("Writing text body into an object");
- InputStream stream = new ByteArrayInputStream(((String) body).getBytes());
+ InputStream stream = new ByteArrayInputStream(((String) body).getBytes(StandardCharsets.UTF_8));
putObjectResult = obsClient.putObject(clientConfigurations.getBucketName(),
clientConfigurations.getObjectName(), stream);
stream.close();
Review Comment:
🔎 **Low — stream not in try-with-resources (consistency):** `stream.close()` is called manually; if `obsClient.putObject()` throws, `close()` is skipped. For a `ByteArrayInputStream` wrapping a byte array, `close()` is a no-op per JDK spec — so there is no actual OS-resource leak here today. However, this is inconsistent with the try-with-resources approach the PR introduces in `OBSUtils`, and if the body type handling ever evolves (e.g. wrapping a real `InputStream`), the pattern will silently leak. A minimal fix:
```suggestion
try (InputStream stream = new ByteArrayInputStream(((String) body).getBytes(StandardCharsets.UTF_8))) {
putObjectResult = obsClient.putObject(clientConfigurations.getBucketName(),
clientConfigurations.getObjectName(), stream);
}
```
--
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-24764: camel-huaweicloud-obs - close the downloaded object stream (connection leak) and fix putObject/charset/proxy issues [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26495:
URL: https://github.com/apache/camel/pull/26495#issuecomment-5694296437
: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