Claus Ibsen created CAMEL-25364:
-----------------------------------
Summary: camel-jbang - a failed run or restart returns its cause,
and camel_run does not start a second copy of an app that already runs from the
directory
Key: CAMEL-25364
URL: https://issues.apache.org/jira/browse/CAMEL-25364
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Two problems with the tools that start an integration, found in the local-model
benchmark (r5, run-order-generator: 9 of the 37 failed steps).
*1. A failed start or restart hides its cause.* When {{camel_control restart}}
or {{camel_run}} fails, the result is the last 4000 characters of the console
output. That is mostly stack frames of the runtime:
{noformat}Restart of run-order-generator failed with exit code 1:
...e.java:177)
at
org.apache.camel.impl.engine.AbstractCamelContext.startingRoutes(AbstractCamelContext.java:1196)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:640)
...{noformat}
The line that says what went wrong is above the cut. The model then calls
camel_get_log and camel_get_errors to find it, and runs out of tool calls. A
person reading it fares no better.
Proposal: return the console output the way {{camel_get_log}} shows a log
(CAMEL-25296). Each record keeps its message, and an error keeps its root cause
and the first frame of the user's code; the stack frames are left out. The
restart result also says that the integration is stopped now and that camel_run
starts it again once the cause is fixed.
*2. {{camel_run}} on a directory whose app already runs starts a second copy.*
After a restart the model often calls {{camel_run}} on the same directory. The
second copy fights the first for ports and files, and the name becomes
ambiguous to the other tools ("No unique Camel process found matching ..."). In
the benchmark one such copy held port 8080 for six hours.
Proposal: when the whole directory is the app ({{camel run --source-dir}}, no
files given) and an integration already runs from that directory, camel_run
returns that one (status running, pid, name) instead of starting another. With
explicit files nothing changes, since one directory may hold several apps.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)