Skip to content

[backport camel-4.22.x] CAMEL-24789: camel-vertx-websocket - finish an exchange with no peer synchronously - #26699

Merged
gnodet merged 1 commit into
apache:camel-4.22.xfrom
gnodet:backport/26541-to-camel-4.22.x
Sep 21, 2026
Merged

gnodet merged 1 commit into
apache:camel-4.22.xfrom
gnodet:backport/26541-to-camel-4.22.x

Conversation

@gnodet

@gnodet gnodet commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Backport of #26541

Cherry-pick of #26541 onto camel-4.22.x.

Original PR: #26541 - CAMEL-24789: camel-vertx-websocket - finish an exchange with no peer synchronously
Original author: @oscerd
Target branch: camel-4.22.x

@gnodet gnodet added components backport indicate that a Pull request is a backport from a fix from the main branch labels Sep 21, 2026
@gnodet
gnodet force-pushed the backport/26541-to-camel-4.22.x branch 3 times, most recently from fac14b6 to bf63d30 Compare September 21, 2026 13:06

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport of #26541 onto camel-4.22.x. The fix is correct.

The bug: process() called callback.done(true) (synchronous completion) but then fell through to return false (claiming async). The exchange would be "finished" by a write handler that never runs — a clear AsyncProcessor contract violation that could leave callers stuck or corrupt routing state.

The fix: Reorder VertxWebsocketResultHandler construction after the empty-peers check, add return true in the empty branch, and demote that log to DEBUG (ordinary broadcast state) while promoting the unmatched-key path to WARN (misconfiguration). All three changes are correct and consistent.

Tests:

  • VertxWebsocketProducerNoPeerTest — unit tests that directly assert the return value, single-callback invariant, and doneSync flag. The PR description confirms these tests actually caught the regression with the original code.
  • VertxWebsocketTest.sendWithAnUnmatchedConnectionKeyDeliversToNobody — integration test verifying that an unmatched connection key delivers to nobody (and doesn't silently fan out to connected peers).

One cosmetic note: anExchangeWithNoBodyIsDoneSynchronously lives in VertxWebsocketProducerNoPeerTest but exercises the null-body early return at the top of process(), not the no-peer path. The test is correct — just slightly mishoused. Not a blocker.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet force-pushed the backport/26541-to-camel-4.22.x branch 2 times, most recently from b07ae89 to 770a7bc Compare September 21, 2026 13:16

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after force-push (rebase-only — same tree as previous commit).

The content is identical to the prior push: the fix and tests are correct, as noted in the previous review. Confirming APPROVE.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet force-pushed the backport/26541-to-camel-4.22.x branch 19 times, most recently from 3e86d3f to 4e7a2e9 Compare September 21, 2026 14:51
@gnodet
gnodet force-pushed the backport/26541-to-camel-4.22.x branch 2 times, most recently from 94fb200 to 5ab3179 Compare September 21, 2026 16:47

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after latest push (commit 5ab3179).

The backport carries the same correct fix from #26541:

  • AsyncProcessor contract: callback.done(true) in the empty-peers branch now pairs with return true, and VertxWebsocketResultHandler construction is correctly moved after the guard. No more sync/async mismatch.
  • Log levels: empty-peers → DEBUG (ordinary broadcast state), unmatched key → WARN (misconfiguration). Both are correct and distinct conditions.
  • Tests: VertxWebsocketProducerNoPeerTest directly asserts the process() return value, single-callback invariant, and doneSync flag — these would have caught the original bug. The integration test verifies unmatched keys deliver to nobody without silently fanning out.

Static analysis (ast-grep): one pre-existing broad-exception-catch on line 106 — unchanged from prior reviews, not introduced by this PR.

Confirming APPROVE.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet force-pushed the backport/26541-to-camel-4.22.x branch 20 times, most recently from 5690dd9 to e43c5bc Compare September 21, 2026 18:30
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 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 have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after latest push (commit 7496264).

The backport carries the same correct fix from #26541 — rebased onto the current camel-4.22.x tip, no content changes:

  • AsyncProcessor contract: callback.done(true) in the empty-peers branch now pairs with return true, and VertxWebsocketResultHandler construction is correctly moved after the guard. No more sync/async mismatch.
  • Log levels: empty-peers → DEBUG (ordinary broadcast state), unmatched key → WARN (misconfiguration). Both conditions are distinct and correctly categorised.
  • Tests: VertxWebsocketProducerNoPeerTest directly asserts the process() return value, single-callback invariant, and doneSync flag. sendWithAnUnmatchedConnectionKeyDeliversToNobody verifies that an unmatched key delivers to nobody without silently fanning out to connected peers.

Static analysis (ast-grep): one pre-existing broad-exception-catch at line 106 — unchanged from prior reviews, not introduced by this PR.

Confirming APPROVE.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after latest push (commit 7334a48).

Rebase-only force-push onto the current camel-4.22.x tip — same tree content as the previous commit (7496264). The fix and tests carry over unchanged:

  • AsyncProcessor contract: callback.done(true) in the empty-peers branch correctly pairs with return true, and VertxWebsocketResultHandler construction remains after the guard. No sync/async mismatch.
  • Log levels: empty-peers → DEBUG (ordinary broadcast state), unmatched key → WARN (misconfiguration). Both conditions are distinct and correctly categorised.
  • Tests: VertxWebsocketProducerNoPeerTest directly asserts the process() return value, single-callback invariant, and doneSync flag. sendWithAnUnmatchedConnectionKeyDeliversToNobody verifies unmatched keys deliver to nobody without silently fanning out to connected peers.

Static analysis (ast-grep): one pre-existing broad-exception-catch at line 106 — unchanged from prior reviews, not introduced by this PR.

Confirming APPROVE.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after latest push (commit 233eb3c).

Rebase-only force-push onto the current camel-4.22.x tip — same tree content as the previous commit (7334a48). The fix and tests carry over unchanged:

  • AsyncProcessor contract: callback.done(true) in the empty-peers branch correctly pairs with return true, and VertxWebsocketResultHandler construction remains after the guard. No sync/async mismatch.
  • Log levels: empty-peers → DEBUG (ordinary broadcast state), unmatched key → WARN (misconfiguration). Both conditions are distinct and correctly categorised.
  • Tests: VertxWebsocketProducerNoPeerTest directly asserts the process() return value, single-callback invariant, and doneSync flag. sendWithAnUnmatchedConnectionKeyDeliversToNobody verifies unmatched keys deliver to nobody without silently fanning out to connected peers.

Static analysis (ast-grep): one pre-existing broad-exception-catch at line 106 — unchanged from prior reviews, not introduced by this PR.

Confirming APPROVE.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@apupier

apupier commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

this is breaking compilation.

[8](https://github.com/apache/camel/actions/runs/35647468492/job/106491783067#step:9:49)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:testCompile (default-testCompile) on project camel-vertx-websocket: Compilation failure
Error: [ERROR] /home/runner/work/camel/camel/components/camel-vertx/camel-vertx-websocket/src/test/java/org/apache/camel/component/vertx/websocket/VertxWebsocketTest.java:[137,9] cannot find symbol
[ERROR]   symbol:   method awaitConnectedPeers(org.apache.camel.component.vertx.websocket.VertxWebsocketEndpoint,int)
[ERROR]   location: class org.apache.camel.component.vertx.websocket.VertxWebsocketTest

as we can see in the PR check job and now on jenkins

I do not find a revert button in the github UI, I will do it locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants