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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.15.2
    • 2.21.0
    • camel-netty4
    • None
    • 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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            yihtserns Yih Tsern
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment