Hi

Ah okay so its not a transaction (eg using a tx manager with jms/jdbc
etc). So that is a bit different.

You can take a look in JMX in the services tree of Camel there is a
AsyncProcessorAwaitManager mbean. It has details if there is a thread
stuck somewhere, which you can then force to free up.

Also you can take a thread dump in the JVM and diagnose the threads to
see which ones there are, and if anyone stand out, related to your
route where you think something is stuck.


On Mon, Dec 30, 2019 at 4:43 PM Mikhail Lukyanov <lukyanov...@gmail.com> wrote:
>
> Hi, Claus.
>
> I have the following reasons
>
> 1) For some reason, the exchange freezes (error, something is not
> available) and the message being processed becomes blocked. I want the user
> to be able to complete this stuck exchange so that the blocked message is
> released and other consumers can start processing it.
>
> 2) Also, when I delete inflight exchanges, but the link to the exchange
> object remains in the pending exchange, which prevents it from being
> completely removed from memory and consumes memory
>
> 3) When an exchange gets stuck, I cannot stop the route with the usual stop.
>
> *camelContext.stopRoute(routeId, 30L, TimeUnit.SECONDS, abortAfterTime);*
>
> When I try to stop the route, I get the following message in the logs
>
>
> *Starting to graceful shutdown 1 routes (timeout 30 seconds)*
>
>
> *Waiting as there are still 2 inflight and pending exchanges to
> complete, timeout in 30 seconds. Inflights per route:
> [cfe84c41-9d83-4967-99c2-4c211676a61a = 2]*
>
> *There are 1 inflight exchanges:
>         InflightExchange: [exchangeId=ID-esb-factor-ts-ru-1577711906085-9-5,
> fromRouteId=cfe84c41-9d83-4967-99c2-4c211676a61a,
> routeId=cfe84c41-9d83-4967-99c2-4c211676a61a,
> nodeId=161d46cd-bc84-4510-8adc-0adbcd2cc092, elapsed=0,
> duration=26167]*
>
> *...*
>
>
> *Interrupted while waiting during graceful shutdown, will abort.*
>
> *Timeout occurred during graceful shutdown. Aborting the shutdown now.
> Notice: some resources may still be running as graceful shutdown did
> not complete successfully.
>
> *Then I delete this stuck exchange from the repository and try again
> to stop the route
>
>
> *camelContext.getInflightRepository().remove(exchange);camelContext.getInflightRepository().remove(exchange,
> routeId);*
>
> I get the following message in the logs
>
> *Starting to graceful shutdown 1 routes (timeout 30 seconds)*
>
> *Waiting as there are still 1 inflight and pending exchanges to
> complete, timeout in 30 seconds. Inflights per route:
> [cfe84c41-9d83-4967-99c2-4c211676a61a = 1]*
>
> *...*
>
>
> *Interrupted while waiting during graceful shutdown, will abort.*
>
> *Timeout occurred during graceful shutdown. Aborting the shutdown now.
> Notice: some resources may still be running as graceful shutdown did
> not complete successfully.
> *
>
> I can only stop the route with a forced stop
>
> *camelContext.stopRoute(routeId, 1L, TimeUnit.SECONDS);*
>
> I use *2.20.2* camel-version.
>
> This behavior is reproduced in my case in different routes, for example,
> where the consumer is *from
> uri="jetty:http://0.0.0.0:7777/get?handlers=KG&amp;throwExceptionOnFailure=true&amp;matchOnUriPrefix=true&amp;bridgeEndpoint=true
> <http://0.0.0.0:7777/get?handlers=KG&amp;throwExceptionOnFailure=true&amp;matchOnUriPrefix=true&amp;bridgeEndpoint=true>"*
> producer *to
> uri="http4://localhost:7080/list?throwExceptionOnFailure=false&amp;httpClient.socketTimeout=30000&amp;httpClient.connectTimeout=30000&amp;httpClient.connectionRequestTimeout=30000&amp;connectionsPerRoute=1000&amp;maxTotalConnections=1000&amp;bridgeEndpoint=true".
> *Or I reproduced in such a route
>
>
>
>
>
>
> *<route factor:name="inflight" id="cfe84c41-9d83-4967-99c2-4c211676a61a">
>           <from id="d83ac94f-cf56-4dc9-a9ba-76b571e0a2de"
> uri="ftp://192.168.194.69/logs/?username=name&amp;password=password
> <ftp://192.168.194.69/logs/?username=name&amp;password=password>">
>       <description>FTP</description>            </from>            <to
> id="161d46cd-bc84-4510-8adc-0adbcd2cc092" uri="activemqq://TEST.IN
> <http://TEST.IN>">                <description>local queue</description>
>         </to>  </route>*
>
>
> пн, 30 дек. 2019 г. в 11:54, Claus Ibsen <claus.ib...@gmail.com>:
>
> > Hi
> >
> > What is your use-case for the reason you want to do this?
> > You should often not do something like this, so want to hear more about
> > why.
> > And what Camel version and what resources are you using for transaction?
> >
> > On Sun, Dec 29, 2019 at 12:52 PM Mikhail Lukyanov <lukyanov...@gmail.com>
> > wrote:
> > >
> > > Hello everyone
> > > Tell me, please, is there a way to kill pending transactions?
> > >
> > > Route freezes, after I kill transactions in InflightRepository
> > >
> > > cc.getInflightRepository().remove(exchange);
> > >
> > > But they remain pending. When I stop the route, it does not stop
> > > immediately because of a pending transaction remain
> > >
> > > int inflight=
> > > this.context.getInflightRepository().size(order.getRoute().getId());
> > > //there 0
> > > inflight += DefaultShutdownStrategy.getPendingInflightExchanges(order);
> > > //but there stil remain
> > >
> > > They are killed only after a forced stop of the route or after the
> > timeout
> > >
> > >
> > > --
> > > *С наилучшими пожеланиями, Лукьянов Михаил*
> > > *Моб: **+7-909-69-71-547*
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
>
> --
> *С наилучшими пожеланиями, Лукьянов Михаил*
> *Моб: **+7-909-69-71-547*



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to