Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-5495

camel-http4 never closes a connection even when connectionTimeToLive is set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jboss-fuse-6.3
    • jboss-fuse-6.2.1
    • Camel
    • % %
    • Hide

      Using Fuse 6.2.1/Camel 2.15.1 implement a Camel route of the following form:

      public class MyRouteBuilder extends RouteBuilder
        {
        public void configure()
            {
            from ("timer://foo?fixedRate=true&period=2000")
              .setHeader(Exchange.HTTP_QUERY, simple("foo=bar")) // Make it a GET request
              .setBody (constant ( "blah\n" ) )
              .setHeader ("Connection", constant ("close"))
              .to ("http4://192.168.1.10:8080/index.jsp?connectionTimeToLive=100")
              .to ("log://foo");
            }
        }
      

      The "to" endpoint refers to any web server that implements HTTP/1.1 persistent connection semantics correct (e.g., Tomcat 7) – connections are assumed to be kept open unless the client specifies otherwise.

      Monitor requests to the web server port using, e.g., tcpdump. Note that Camel never makes a connection with the header "Connection: close" (even though that header is set explicitly, and even though connectionTimeToLive is set).

      Show
      Using Fuse 6.2.1/Camel 2.15.1 implement a Camel route of the following form: public class MyRouteBuilder extends RouteBuilder { public void configure() { from ( "timer: //foo?fixedRate= true &period=2000" ) .setHeader(Exchange.HTTP_QUERY, simple( "foo=bar" )) // Make it a GET request .setBody (constant ( "blah\n" ) ) .setHeader ( "Connection" , constant ( "close" )) .to ( "http4: //192.168.1.10:8080/index.jsp?connectionTimeToLive=100" ) .to ( "log: //foo" ); } } The "to" endpoint refers to any web server that implements HTTP/1.1 persistent connection semantics correct (e.g., Tomcat 7) – connections are assumed to be kept open unless the client specifies otherwise. Monitor requests to the web server port using, e.g., tcpdump. Note that Camel never makes a connection with the header "Connection: close" (even though that header is set explicitly, and even though connectionTimeToLive is set).

      When camel-http4 is used in issue GET requests on a remote web server, it will use the same connection indefinitely: no request ever has the Connection: Close header. This is the case even when connectionTimeToLive is set to a small value. The connection will remain open until the server closes it, which may be never.

      HTTP/1.1 allows the server to assume that the client will keep the connection open unless it states otherwise. However, the connectionTimeToLive parameter appears to provide a way to indicate when the client should, indeed, state otherwise. However, it has no effect on connection lifetime.

      Some HTTP firewalls forcibly close long-running connections, so there needs to be some way to control connection lifetime.

            acosenti Andrea Cosentino
            rhn-support-kboone Kevin Boone
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: