Skip to content

CAMEL-27149: camel-jbang - camel stop <pid> of the process that launched an integration stops that integration - #30321

Merged
davsclaus merged 2 commits into
apache:mainfrom
davsclaus:CAMEL-27149
Nov 18, 2026
Merged

davsclaus merged 2 commits into
apache:mainfrom
davsclaus:CAMEL-27149

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

CAMEL-27149: camel stop <pid> can now be given the pid of the process that launched an integration, such as the shell or the JBang launcher of camel run. It stops the Camel integrations that process launched. Before 4.24.0 ships, this restores what Citrus relies on.

The regression

Since CAMEL-26911 and CAMEL-26929, camel stop <pid> accepts only the pid of a running Camel integration, and exits 3 for any other pid. In 4.23 a numeric pid was used as given, so the process got a SIGTERM.

Citrus (CamelStopIntegrationAction) keeps the pid of the process it started. On Linux that is the launcher, while the Camel JVM is its child: 3469 and 3470, 3906 and 3907, and so on. At the end of each test Citrus runs camel stop 3469, and it stops the children only after that command succeeds.

With 4.24.0-SNAPSHOT:

  • the command exits 3;
  • every Citrus test fails in its final actions;
  • the integrations are never stopped.

The integration tests of camel-kamelets on 4.24.0-SNAPSHOT (apache/camel-kamelets#3186) show it: 35 tests failed with Failed to stop Camel integration - exit code 3, and the runner was shut down.

The fix

When the pid is not a Camel integration, StopProcess takes the running Camel integrations that are descendants of that process, and stops them as it does any integration: it deletes the pid file, and waits.

Two things do not change:

  • The CAMEL-26911 safety: the launcher, or any other process that is not a Camel integration, is never signalled.
  • A pid with no integration below it still exits 3.
$ camel stop 27880
PID 27880 is not a Camel integration: stopping the Camel integration it launched
Shutting down Camel integration (PID: 27883)

The camel stop section of the docs says so.

Tests

  • StopProcessTest:

    • the pid of a launcher stops the integration it launched, and the launcher is never signalled;
    • a pid whose child is not an integration fails with exit 3, and nothing is signalled.

    The process and common tests of camel-jbang-core (761) pass.

  • End to end: I started an integration as Citrus does on Linux, under a parent process (bash -c "jbang camel@apache/camel run tick.yaml; true"), then ran camel stop <parent pid>:

    CLI Exit Integration
    main 3, "No running Camel integration matches: 28170" still running
    this PR 0 stopped, and the parent exited

Claude Code on behalf of Claus Ibsen

🤖 Generated with Claude Code

…hed an integration stops that integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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.

The fix is correct and the approach is safe — launchedBy() short-circuits for --all, non-numeric names, and existing Camel integration pids, so the existing code paths are unchanged. The two new tests cover the success and failure cases, and the verify(launcher, never()).destroy() assertions confirm the safety constraint.

One doc finding below; the code and tests are solid.

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

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-core

🔬 Scalpel shadow comparison — Scalpel: 5 of 729 tested, 8 compile-only — current: 5 all tested

Maveniverse Scalpel detected 5 affected modules (current approach: 5).

Skip-tests mode would test 5 modules (2 direct + 5 downstream), skip tests for 8 (generated code, meta-modules)

Modules Scalpel would test (5)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-jbang-core
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
Modules with tests skipped (8)
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-core: 2 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (15 modules, 3m 45s total)

Total reactor time: 3m 45s

Module Duration Status
Camel :: Launcher 53.7s SUCCESS
Camel :: JBang :: MCP 44.2s SUCCESS
Camel :: JBang :: Plugin :: Validate 26.8s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 22.7s SUCCESS
Camel :: Docs 22.3s SUCCESS
Camel :: JBang :: Plugin :: Testing 17.1s SUCCESS
Camel :: JBang :: Plugin :: Generate 14.2s SUCCESS
Camel :: JBang :: Plugin :: Edit 8.1s SUCCESS
Camel :: JBang :: Plugin :: MCP 6.5s SUCCESS
Camel :: Coverage 4.8s SUCCESS
Camel :: JBang :: Integration tests 1.9s SUCCESS
Camel :: JBang :: Main 1.7s SUCCESS
Camel :: Launcher :: Container 1.1s SUCCESS
Camel :: JBang :: Core n/a
Camel :: JBang :: Plugin :: TUI n/a

Top 20 slowest modules:

  • Camel :: Launcher (53.7s)
  • Camel :: JBang :: MCP (44.2s)
  • Camel :: JBang :: Plugin :: Validate (26.8s)
  • Camel :: JBang :: Plugin :: Kubernetes (22.7s)
  • Camel :: Docs (22.3s)
  • Camel :: JBang :: Plugin :: Testing (17.1s)
  • Camel :: JBang :: Plugin :: Generate (14.2s)
  • Camel :: JBang :: Plugin :: Edit (8.1s)
  • Camel :: JBang :: Plugin :: MCP (6.5s)
  • Camel :: Coverage (4.8s)
  • Camel :: JBang :: Integration tests (1.9s)
  • Camel :: JBang :: Main (1.7s)
  • Camel :: Launcher :: Container (1.1s)

⚙️ View full build and test results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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.

Following up on my earlier review — the one finding has been addressed.

The sentence was split into three shorter active-voice sentences. ✅

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

@davsclaus
davsclaus merged commit bfd0ce4 into apache:main Nov 18, 2026
7 checks passed
@davsclaus davsclaus added this to the 4.24.0 milestone Nov 18, 2026
@davsclaus davsclaus added the bug Something isn't working label Nov 18, 2026
@davsclaus davsclaus self-assigned this Nov 18, 2026

@oscerd oscerd 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.

Good restoration that does not undo the safety it builds on. CAMEL-26911 tightened camel stop <pid> to signal only a verified running Camel integration, which is what stopped it from killing a pid-reused unrelated process, but it also broke giving it the pid of the launcher (the shell or JBang launcher of camel run), which Citrus relies on.

The fix is the right shape: when the pid is not itself a Camel integration, launchedBy finds the integrations that process started (the Camel JVM is its child) and stops those, falling back to the direct integration lookup otherwise, and a match of nothing exits with code 3. Crucially it still signals only verified Camel integrations, the children, never the raw launcher pid, so the pid-reuse protection from CAMEL-26911 is intact: this widens what you can name without widening what gets signalled. Landing it before 4.24.0 so Citrus keeps working is the right call. Good.

Claude Code on behalf of oscerd

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

Labels

bug Something isn't working docs dsl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants