Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-1976

AjpAprProtocol: idle connection is not closed until twice as keepAliveTimeout has elapsed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • 3.1.15.GA
    • 3.1.10.GA
    • tomcat8
    • False
    • False
    • Undefined
    • Hide

      Option A. Set the keepAliveTimeout to half time.

      <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
              connectionTimeout="10000" keepAliveTimeout="5000"/>
      

      Option B. Use a protocol other than AjpAprProtocol. This issue does not occur in AjpProtocol, AjpNioProtocol, and AjpNio2Protocol.

      <Connector port="8009" protocol="org.apache.coyote.ajp.AjpNioProtocol" redirectPort="8443" 
              connectionTimeout="10000" keepAliveTimeout="10000"/>
      

      Option C. Move to JWS5. This issue does not occur in JWS 5.0.0 or later.

      Show
      Option A. Set the keepAliveTimeout to half time. <Connector port= "8009" protocol= "AJP/1.3" redirectPort= "8443" connectionTimeout= "10000" keepAliveTimeout= "5000" /> Option B. Use a protocol other than AjpAprProtocol. This issue does not occur in AjpProtocol, AjpNioProtocol, and AjpNio2Protocol. <Connector port= "8009" protocol= "org.apache.coyote.ajp.AjpNioProtocol" redirectPort= "8443" connectionTimeout= "10000" keepAliveTimeout= "10000" /> Option C. Move to JWS5. This issue does not occur in JWS 5.0.0 or later.
    • Hide

      1. Extract JWS 3.1.10 zip

      unzip jws-application-servers-3.1.0-RHEL7-x86_64.zip
      unzip -o jws-3.1.10-application-servers-RHEL7-x86_64.zip
      

      2. Add the following AJP connector to jws-3.1/tomcat8/conf/server.xml

      <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
              connectionTimeout="10000" keepAliveTimeout="10000"/>
      

      3. Add log level setting to tomcat8/conf/logging.properties

      org.apache.tomcat.util.net.AprEndpoint.level = FINE
      

      4. In Apache side, add AJP proxy configuration to any version of Apache

      ProxyPass / ajp://127.0.0.1:8009/
      

      5. Send a request by curl

      curl 127.0.0.1
      

      Then, we can see following log in the console:

      // Response end: 20:19:17
      05-Feb-2021 20:19:17.545 FINE [ajp-apr-8009-Acceptor-0] org.apache.tomcat.util.net.AprEndpoint.processSocketWithOptions socket [139,851,114,483,296]
      
      // When the keepAliveTimeout time elapses, the following log will appear, the idle connection is still not closed at this point.
      05-Feb-2021 20:19:27.640 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.run Add to poller socket [139,851,114,483,296]
      05-Feb-2021 20:19:27.641 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller
      
      // After 10 seconds, the following log will appear and the idle connection is closed at this point
      05-Feb-2021 20:19:37.647 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.maintain Timing out [139,851,114,483,296]
      05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller
      05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Removed [139,851,114,483,296] from poller
      
      Show
      1. Extract JWS 3.1.10 zip unzip jws-application-servers-3.1.0-RHEL7-x86_64.zip unzip -o jws-3.1.10-application-servers-RHEL7-x86_64.zip 2. Add the following AJP connector to jws-3.1/tomcat8/conf/server.xml <Connector port= "8009" protocol= "AJP/1.3" redirectPort= "8443" connectionTimeout= "10000" keepAliveTimeout= "10000" /> 3. Add log level setting to tomcat8/conf/logging.properties org.apache.tomcat.util.net.AprEndpoint.level = FINE 4. In Apache side, add AJP proxy configuration to any version of Apache ProxyPass / ajp://127.0.0.1:8009/ 5. Send a request by curl curl 127.0.0.1 Then, we can see following log in the console: // Response end: 20:19:17 05-Feb-2021 20:19:17.545 FINE [ajp-apr-8009-Acceptor-0] org.apache.tomcat.util.net.AprEndpoint.processSocketWithOptions socket [139,851,114,483,296] // When the keepAliveTimeout time elapses, the following log will appear, the idle connection is still not closed at this point. 05-Feb-2021 20:19:27.640 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.run Add to poller socket [139,851,114,483,296] 05-Feb-2021 20:19:27.641 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller // After 10 seconds, the following log will appear and the idle connection is closed at this point 05-Feb-2021 20:19:37.647 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.maintain Timing out [139,851,114,483,296] 05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller 05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Removed [139,851,114,483,296] from poller

    Description

      If AjpAprProtocol as JWS3 on RHEL7 default is used, the idle connection is not closed until twice as keepAliveTimeout has elapsed.

      With the below connector settings, idle connections that are 10 seconds elapsed are expected to be closed, but it actually takes 20 seconds to be closed.

      <Connector port="8009" protocol="org.apache.coyote.ajp.AjpAprProtocol " redirectPort="8443" 
              connectionTimeout="10000" keepAliveTimeout="10000"/>
      

      This issue occurs every time and is reproducible. When this issue is reproduced, the following log appears in the console:

      // Response end: 20:19:17
      05-Feb-2021 20:19:17.545 FINE [ajp-apr-8009-Acceptor-0] org.apache.tomcat.util.net.AprEndpoint.processSocketWithOptions socket [139,851,114,483,296]
      
      // When the keepAliveTimeout time elapses, the following log will appear, the idle connection is still not closed at this point.
      05-Feb-2021 20:19:27.640 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.run Add to poller socket [139,851,114,483,296]
      05-Feb-2021 20:19:27.641 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller
      
      // After 10 seconds, the following log will appear and the idle connection is closed at this point
      05-Feb-2021 20:19:37.647 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.maintain Timing out [139,851,114,483,296]
      05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller
      05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Removed [139,851,114,483,296] from poller
      

      Attachments

        Activity

          People

            huwang@redhat.com Hui Wang
            rhn-support-nagetsum Norito Agetsuma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: