Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12103

Camel unable to shutdown gracefully because Netty4 consumer keep receiving and adding inflight exchanges

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.15.2
    • Fix Version/s: 2.21.0
    • Component/s: camel-netty4
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

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

      And I have this issue when initiating Camel shutdown using DefaultShutdownStrategy:

      1. Camel suspends NettyConsumer (SingleTCPNettyServerBootstrapFactory), which only stops the "main" Netty channel, but not the other Netty channels (i.e. socket connections)
      2. Camel waits for routes to be empty of inflight & pending exchanges
      3. 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
      4. Forced shutdown after 5 minutes (timed out)

      To simulate the issue

      1. Run the attached tcp-server.camel Groovy script: groovy tcp-server.camel
      2. After that has started, run the attached tcp-client.groovy: groovy tcp-client.groovy
      3. After tcp-client starts sending data over, stop the tcp-server (CTRL+C in Windows)
      4. You should see something like this:
        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.
        ...

        Attachments

        1. tcp-client.groovy
          0.3 kB
          Yih Tsern
        2. tcp-server.camel
          0.3 kB
          Yih Tsern

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              yihtserns Yih Tsern
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: