Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12484

Pushing and pulling when using an AJP connector can fail or hang

    XMLWordPrintable

Details

    Description

      Issue Summary

      Pushing and pulling using HTTP(S) via a reverse proxy or load balancer can fail or hang when using an AJP connector on Bitbucket Server rather than an HTTP(S) connector.

      Steps to Reproduce

      (These steps are for a push; the issue can also be seen for clones, however)

      1. Clone a large repo from another source (reproduced with 21GB git repository on disk)
      2. Run Bitbucket with following properties
        -Dserver.additional-connector.1.connector-protocol=AJP/1.3
        -Dserver.additional-connector.1.port=7991
        
      3. Use following command to start AJP proxy to local bitbucket server
        docker run -i --rm -p 8080:80 httpd:alpine sh -c $'printf \'LogLevel debug\nLoadModule proxy_module modules/mod_proxy.so\nLoadModule proxy_ajp_module modules/mod_proxy_ajp.so\nProxyPass "/bitbucket" "ajp://host.docker.internal:7991/bitbucket"\n\' >> /usr/local/apache2/conf/httpd.conf && exec httpd-foreground'
        

        If you use http://localhost:8080/bitbucket it will go use this proxy.

      4. Create an empty repo.
      5. cd to large repo cloned earlier and push to newly created empty repo using following command
        git remote set-url origin http://localhost:8080/bitbucket/scm/key/slug.git
        git push -u origin --all
        git push origin --tags
        

      Expected Results

      Git finishes command successfully after setting the remote branch and return the console to the user. The repository pushed through successfully.

      Actual Results

      The push hangs indefinitely.
      The below exception is thrown in the atlassian-bitbucket.log file:

      2020-07-22 09:53:49,286 WARN  [http-scmrequest-handler:thread-4] jdoe @1LJHAD5x1114x315x0 1.1.1.1 "GET /scm/key/slug.git/info/refs HTTP/1.1" c.a.s.i.s.g.p.http.CgiStdinHandler [/usr/local/bin/git http-backend] exited cleanly, but stdin was never closed
      2020-07-22 09:54:09,530 INFO  [http-scmrequest-handler:thread-4] jdoe @1LJHAD5x1114x315x0 1.1.1.1 "POST /scm/key/slug.git/git-receive-pack HTTP/1.1" c.a.s.i.s.g.p.h.GitSmartExitHandler KEY/slug[1]: Read request from 2.2.2.2 failed due to a socket timeout
      

      Notes

      The same issue can happen with pulling the repository.

      Workaround

      Use SSH for hosting, or configure Bitbucket Server with an HTTP(S) connector instead of AJP. (Note that even if using an HTTP connector it's still possible to terminate SSL at a reverse proxy or load balancer; AJP is not required for that.)

      Attachments

        Issue Links

          Activity

            People

              wkritzinger Wolfgang Kritzinger
              ashaleev Anton Shaleev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync