[
https://issues.apache.org/jira/browse/CAMEL-27294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148196#comment-18148196
]
Guillaume Nodet commented on CAMEL-27294:
-----------------------------------------
This issue is being investigated by a coding agent (on behalf of gnodet).
Triage analysis: All three affected consumers (KnativeHttpConsumer,
VertxWebsocketConsumer, VertxWebsocketClientConsumer) use executeBlocking with
a synchronous processor, holding the Vert.x worker thread for the entire route
duration. The fix pattern is established in
VertxPlatformHttpConsumer.processExchange() (commit 5b3fa2df443c /
CAMEL-27217): use the two-argument async process(exchange, callback), complete
back on the original Vert.x context via context.runOnContext, and optionally
support a synchronous option. No commits or PRs address CAMEL-27294 yet. Single
PR scope.
_Note: This comment was generated by an AI coding agent and requires manual
verification._
> camel-knative-http and camel-vertx-websocket - the route no longer holds a
> Vert.x worker thread while it waits for another thread
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27294
> URL: https://issues.apache.org/jira/browse/CAMEL-27294
> Project: Camel
> Issue Type: Bug
> Components: camel-knative-http, camel-vertx-websocket
> Reporter: Claus Ibsen
> Assignee: Guillaume Nodet
> Priority: Major
> Fix For: 4.25.0
>
>
> Follow-up of CAMEL-27217 (PR https://github.com/apache/camel/pull/30468),
> which fixed this for camel-platform-http-vertx.
> These consumers start the route in vertx.executeBlocking and run it with the
> synchronous processor, so the Vert.x worker thread waits (in the
> AsyncProcessorAwaitManager) until the whole route is complete:
> * KnativeHttpConsumer (camel-knative-http):
> getAsyncProcessor().process(exchange), which is the blocking variant
> * VertxWebsocketConsumer (camel-vertx-websocket):
> getProcessor().process(exchange)
> * VertxWebsocketClientConsumer (camel-vertx-websocket):
> getProcessor().process(exchange)
> When the route calls an asynchronous producer that needs a worker thread of
> the same Vert.x to complete its exchange (for example vertx-http, which
> completes in executeBlocking), and as many messages are in flight as there
> are worker threads (20 by default), every worker thread waits for its route
> and no producer completion gets a worker thread. The consumer then stops
> processing for good. This happens when the consumer and the producer share
> one Vert.x, such as a Vertx instance in the registry, or in Camel Quarkus.
> Do the same as CAMEL-27217:
> * Start the route on a worker thread, but with the asynchronous processor
> (process(exchange, callback)), so the worker thread is freed when the route
> continues on another thread.
> * Complete the result on the original Vert.x context (context.runOnContext),
> so the reply / websocket handling still runs where it does today.
> * Consider the same synchronous option (default false) to keep the current
> behaviour, where the worker thread runs the whole route and the worker pool
> limits the messages in flight.
> * Vert.x 5 executeBlocking both fails its future and rethrows
> RejectedExecutionException when the worker pool is shut down, so wrap the
> call, so that the failure handler is always attached. The same applies to
> VertxPlatformHttpConsumer.processExchange (left open in #30468).
> Add a test with a shared Vert.x with 2 worker threads and a route that calls
> vertx-http, as VertxPlatformHttpSharedVertxWorkerPoolTest does.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)