Yih Tsern created CAMEL-12103:
---------------------------------

             Summary: Camel unable to shutdown gracefully because Netty4 
consumer keep receiving and adding inflight exchanges
                 Key: CAMEL-12103
                 URL: https://issues.apache.org/jira/browse/CAMEL-12103
             Project: Camel
          Issue Type: Bug
          Components: camel-netty4
    Affects Versions: 2.15.2
            Reporter: Yih Tsern
         Attachments: tcp-client.groovy, tcp-server.camel

I'm using this URI: {{netty4:tcp://localhost:8888?sync=false&textline=true}}

And I have this issue when initiating Camel shutdown using 
{{DefaultShutdownStrategy}}:
# Camel suspends {{NettyConsumer}} ({{SingleTCPNettyServerBootstrapFactory}}), 
which only stops the "main" Netty channel, but _not_ the other Netty channels 
(i.e. socket connections)
# Camel waits for routes to be empty of inflight & pending exchanges
# (!) Those other Netty channels kept receiving data, which are turned into new 
exchanges
** As long as the TCP clients keep sending data into the channels + exchanges 
completing slower than send rate, routes will _never_ be empty of inflight & 
pending exchanges
# Forced shutdown after 5 minutes (timed out)

h2. To simulate the issue
# Run the attached [^tcp-server.camel] Groovy script: {{groovy 
tcp-server.camel}}
# After that has started, run the attached [^tcp-client.groovy]: {{groovy 
tcp-client.groovy}}
# After tcp-client starts sending data over, stop the tcp-server (CTRL+C in 
Windows)
# You should see something like this:
{panel:title=cmd}
INFO  - Apache Camel 2.15.2 (CamelContext: camel-1) started in 1.015 seconds
INFO  - Hey 0
INFO  - Hey 1
INFO  - Hey 2
INFO  - Hey 3
INFO  - Apache Camel 2.15.2 (CamelContext: camel-1) is shutting down
INFO  - Starting to graceful shutdown 1 routes (timeout 300 seconds)
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 300 seconds.
INFO  - Hey 4
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 299 seconds.
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 298 seconds.
INFO  - Hey 5
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 297 seconds.
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 296 seconds.
INFO  - Hey 6
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 295 seconds.
INFO  - Waiting as there are still 1 inflight and pending exchanges to complete,
 timeout in 294 seconds.
...
{panel}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to