Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5753

Standalone install does not work with Apache + mod_proxy_ajp + SSL

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • core
    • None
    • CentOS release 5.4 (Final)
      2.6.18-164.10.1.el5xen (64 bit)
      java version "1.6.0_16"
      hudson-1.347-1.1
      httpd-2.2.3-31.el5.centos.2

      I've configured hudson to only use the ajp connector using a command line similar to

      /usr/lib/jvm/java-1.6.0/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -Xmx64m -DHUDSON_HOME=/space/hudson -jar /usr/lib/hudson/hudson.war --logfile=/var/log/hudson/hudson.log --daemon --prefix=hudson --httpPort=-1 --ajp13Port=8109 --debug=5 --handlerCountMax=10 --handlerCountMaxIdle=0
      

      I'm using the following apache configuration file

          ProxyRequests Off
          ProxyPreserveHost On
      
          <Proxy *>
              Order deny,allow
              Allow from all
          </Proxy>
      
          ProxyPass /hudson ajp://localhost:8109/hudson retry=1
          ProxyPassReverse /hudson ajp://localhost:8109/hudson
      
      

      When accessing https://host/hudson , I get a 503 error page from Apache. The apache logs contain:

      [Wed Feb 24 23:58:04 2010] [error] ajp_read_header: ajp_ilink_receive failed
      [Wed Feb 24 23:58:04 2010] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
      

      while the winstone logs contain:

      [Winstone 2010/02/24 23:58:04] - Error within request handler thread
      java.lang.StringIndexOutOfBoundsException: String index out of range: 1065
              at java.lang.String.checkBounds(String.java:401)
              at java.lang.String.<init>(String.java:442)
              at winstone.ajp13.Ajp13IncomingPacket.readString(Ajp13IncomingPacket.java:275)
              at winstone.ajp13.Ajp13IncomingPacket.parsePacket(Ajp13IncomingPacket.java:189)
              at winstone.ajp13.Ajp13Listener.allocateRequestResponse(Ajp13Listener.java:179)
              at winstone.RequestHandlerThread.run(RequestHandlerThread.java:79)
              at java.lang.Thread.run(Thread.java:619)
      

      It's worth mentioning that this was working with Tomcat 6.0.20 , but stopped working when I tried to move over to the standalone install.

      I've tried various combinations with or without prefix, and the only one which seems to work is ajp without any prefix.

          [JENKINS-5753] Standalone install does not work with Apache + mod_proxy_ajp + SSL

          Robert Munteanu created issue -

          mka2 added a comment -

          The AJP connector of the Winstone servlet container is broken. This bug has been reported in Winstone's bug tracker:

          Problem with AJP running behind Apache 2.2 mod_proxy - ID: 2895779

          Error within request handler thread, Ajp13Listener.ShortPac - ID: 2823683

          The workaround is to use a "real" servlet container like Tomcat or Jetty, they have working AJP connectors.

          mka2 added a comment - The AJP connector of the Winstone servlet container is broken. This bug has been reported in Winstone's bug tracker: Problem with AJP running behind Apache 2.2 mod_proxy - ID: 2895779 Error within request handler thread, Ajp13Listener.ShortPac - ID: 2823683 The workaround is to use a "real" servlet container like Tomcat or Jetty, they have working AJP connectors.

          Thanks for the information. I'll try to use the HTTP connector then, since the rpm is much more convenient than the war download.

          Robert Munteanu added a comment - Thanks for the information. I'll try to use the HTTP connector then, since the rpm is much more convenient than the war download.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/hudson/main/war/pom.xml
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/31635
          Log:
          [FIXED JENKINS-5753] Integrated winstone 0.9.10-hudson-20 to fix the AJP parsing problem.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/war/pom.xml trunk/www/changelog.html http://jenkins-ci.org/commit/31635 Log: [FIXED JENKINS-5753] Integrated winstone 0.9.10-hudson-20 to fix the AJP parsing problem.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          lbeuster added a comment - - edited

          hmm, still doesn't work for me with Apache 1.2.14 mod_proxy/mod_rewrite + Hudson 1.361:

          Hudson:
          -----------------------------

          [Winstone 2010/06/09 15:30:29] - Error within request handler thread
          java.io.EOFException
          at java.io.DataInputStream.readFully(DataInputStream.java:180)
          at java.io.DataInputStream.readFully(DataInputStream.java:152)
          at winstone.ajp13.Ajp13IncomingPacket.readString(Ajp13IncomingPacket.java:237)
          at winstone.ajp13.Ajp13IncomingPacket.readString(Ajp13IncomingPacket.java:224)
          at winstone.ajp13.Ajp13IncomingPacket.parsePacket(Ajp13IncomingPacket.java:161)
          at winstone.ajp13.Ajp13Listener.allocateRequestResponse(Ajp13Listener.java:179)
          at winstone.RequestHandlerThread.run(RequestHandlerThread.java:79)
          at java.lang.Thread.run(Thread.java:619)

          Apache:
          -------------------
          [Wed Jun 09 15:30:29 2010] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
          [Wed Jun 09 15:30:29 2010] [error] ajp_read_header: ajp_ilink_receive failed
          [Wed Jun 09 15:30:29 2010] [error] (120006)APR does not understand this error code: proxy: read response failed from (null)

          Another workaround that works wirh Hudson standalone is mod_jk instead of mod_proxy.

          Regards
          Lars

          lbeuster added a comment - - edited hmm, still doesn't work for me with Apache 1.2.14 mod_proxy/mod_rewrite + Hudson 1.361: Hudson: ----------------------------- [Winstone 2010/06/09 15:30:29] - Error within request handler thread java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:180) at java.io.DataInputStream.readFully(DataInputStream.java:152) at winstone.ajp13.Ajp13IncomingPacket.readString(Ajp13IncomingPacket.java:237) at winstone.ajp13.Ajp13IncomingPacket.readString(Ajp13IncomingPacket.java:224) at winstone.ajp13.Ajp13IncomingPacket.parsePacket(Ajp13IncomingPacket.java:161) at winstone.ajp13.Ajp13Listener.allocateRequestResponse(Ajp13Listener.java:179) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:79) at java.lang.Thread.run(Thread.java:619) Apache: ------------------- [Wed Jun 09 15:30:29 2010] [error] (70014)End of file found: ajp_ilink_receive() can't receive header [Wed Jun 09 15:30:29 2010] [error] ajp_read_header: ajp_ilink_receive failed [Wed Jun 09 15:30:29 2010] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) Another workaround that works wirh Hudson standalone is mod_jk instead of mod_proxy. Regards Lars

          acdha added a comment -

          This is definitely still broken. Just reproduced using the latest 1.367 .deb on Ubuntu 10.04 with this config:

          ProxyRequests Off
          ProxyPass /hudson ajp://127.0.0.1:8102/hudson
          ProxyPassReverse /hudson ajp://127.0.0.1:8102/hudson

          Example log output:

          [Fri Jul 23 14:57:44 2010] [error] ajp_read_header: ajp_ilink_receive failed
          [Fri Jul 23 14:57:44 2010] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (127.0.0.1)

          acdha added a comment - This is definitely still broken. Just reproduced using the latest 1.367 .deb on Ubuntu 10.04 with this config: ProxyRequests Off ProxyPass /hudson ajp://127.0.0.1:8102/hudson ProxyPassReverse /hudson ajp://127.0.0.1:8102/hudson Example log output: [Fri Jul 23 14:57:44 2010] [error] ajp_read_header: ajp_ilink_receive failed [Fri Jul 23 14:57:44 2010] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (127.0.0.1)
          acdha made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          Similar error:
          Thu Aug 19 15:02:02 2010] [notice] Apache/2.2.14 (Ubuntu) DAV/2 SVN/1.6.6 proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k configured – resuming normal operations
          [Thu Aug 19 15:02:06 2010] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
          [Thu Aug 19 15:02:06 2010] [error] ajp_read_header: ajp_ilink_receive failed

          Régis Desgroppes added a comment - Similar error: Thu Aug 19 15:02:02 2010] [notice] Apache/2.2.14 (Ubuntu) DAV/2 SVN/1.6.6 proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k configured – resuming normal operations [Thu Aug 19 15:02:06 2010] [error] (70014)End of file found: ajp_ilink_receive() can't receive header [Thu Aug 19 15:02:06 2010] [error] ajp_read_header: ajp_ilink_receive failed

          Curtis Ruck added a comment -

          Still having this issue with httpd 2.2.15, w/ 1.452. We have been using the Jenkins RPM so its easier to stay current, any chance of switching winstone out with Jetty?

          Curtis Ruck added a comment - Still having this issue with httpd 2.2.15, w/ 1.452. We have been using the Jenkins RPM so its easier to stay current, any chance of switching winstone out with Jetty?

            Unassigned Unassigned
            rombert Robert Munteanu
            Votes:
            16 Vote for this issue
            Watchers:
            26 Start watching this issue

              Created:
              Updated:
              Resolved: