Andrea Cosentino created CAMEL-26606:
----------------------------------------
Summary: camel-platform-http-vertx - a failed bind of the HTTP
server is only logged, so the CamelContext starts with nothing listening
Key: CAMEL-26606
URL: https://issues.apache.org/jira/browse/CAMEL-26606
Project: Camel
Issue Type: Bug
Components: camel-platform-http-vertx
Affects Versions: 4.22.0
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
In {{VertxPlatformHttpServer.startServer()}}, the result of
{{HttpServer.listen(...)}} is handled in the {{onComplete}} callback. When the
bind fails (for example with {{Address already in use}}), the callback logs a
WARN and throws a {{RuntimeException}}. That exception is thrown in the Vert.x
callback, not in the thread that waits on the latch. The latch is counted down
in {{finally}}, the {{CompletableFuture.runAsync}} task completes normally, and
{{startServer()}} returns. The {{CamelContext}} starts, and its routes report
as started, although nothing listens on the port.
Seen with the Camel Kafka Connector webhook source connector, which uses
camel-platform-http-main. A second task on the same worker, or a task restarted
before the previous one released the port, stays RUNNING but never receives a
request.
*Expected:* a failed bind makes the HTTP server, and so the {{CamelContext}},
fail to start, with the bind error as the cause.
*Fix:* keep the failure from the callback (for example in an
{{AtomicReference}}) and rethrow it from {{startServer()}} after the latch.
_Claude Code on behalf of Andrea Cosentino_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)