• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      When cloning a large repository over HTTP, the git server goes quiet for quite some time, busy computing a pack file. Normally, Apache is configured such that a prolonged inactivity in a socket will trigger a shutdown. So what the end user sees is that after a while, "git clone" fails by the unexpected connection reset by the server.

      If the user tries the same command from the shell, Git silently adds the --progress option (see the quote from the man page.) This keeps the socket chatty enough to avoid a shutdown from Apache.

      --progress
          Progress status is reported on the standard error stream by default when it is attached to a terminal,
          unless -q is specified. This flag forces progress status even if the standard error stream is not
          directed to a terminal.
      

      So the unsuspecting users would end up concluding that Jenkins is broken.

      Even worse, normally the server is owned by a different person, which makes it difficult to tweak the Apache setting. Besides, there are legitimate reasons why Apache needs to shutdown idle connections (for example to avoid DoS attack.)

      So to improve the user experience, I think the best course of action is for the Git plugin to add the --progress option to the "git clone" command. We don't need to report the git clone output unless it fails, so this doesn't clutter the output, and in this way Jenkins would Just Work (TM).

          [JENKINS-9168] "git clone" should add --progress

          I should clarify that the current behaviour of "git clone" is that it never reports its output, even in the case of a failure.

          Kohsuke Kawaguchi added a comment - I should clarify that the current behaviour of "git clone" is that it never reports its output, even in the case of a failure.

          Yes, adding the '--progress' argument in the clone method of GITApi.java resolved the issue. Secondly, I noticed the Git clone fails when GIT_TRACE is enabled with this error:
          FATAL: Invalid id: setup: git_dir: .git
          java.lang.IllegalArgumentException: Invalid id: setup: git_dir: .git
          at org.spearce.jgit.lib.ObjectId.fromString(ObjectId.java:230)
          at hudson.plugins.git.GitAPI.revList(GitAPI.java:850)

          It's failing because with GIT_TRACE enabled extra arguments are being printed and the BufferedReader is passing an incorrect argument i.e. setup: git_dir: .git to the org.spearce.jgit.lib.ObjectId.fromString method instead of passing the 40-digit commit id.
          hudson.plugins.git.GitAPI.revList(GitAPI.java:850 should handle the parsing of strings in a more smarter way irrespective of whether GIT_TRACE is enabled or not.

          Harmeek Jhutty added a comment - Yes, adding the '--progress' argument in the clone method of GITApi.java resolved the issue. Secondly, I noticed the Git clone fails when GIT_TRACE is enabled with this error: FATAL: Invalid id: setup: git_dir: .git java.lang.IllegalArgumentException: Invalid id: setup: git_dir: .git at org.spearce.jgit.lib.ObjectId.fromString(ObjectId.java:230) at hudson.plugins.git.GitAPI.revList(GitAPI.java:850) It's failing because with GIT_TRACE enabled extra arguments are being printed and the BufferedReader is passing an incorrect argument i.e. setup: git_dir: .git to the org.spearce.jgit.lib.ObjectId.fromString method instead of passing the 40-digit commit id. hudson.plugins.git.GitAPI.revList(GitAPI.java:850 should handle the parsing of strings in a more smarter way irrespective of whether GIT_TRACE is enabled or not.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/hudson/plugins/git/GitAPI.java
          http://jenkins-ci.org/commit/git-plugin/aa753c3b736d7e3759b9a7aeeec2636592dd92d0
          Log:
          [FIXED JENKINS-9168] Added --progress to git clone.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/hudson/plugins/git/GitAPI.java http://jenkins-ci.org/commit/git-plugin/aa753c3b736d7e3759b9a7aeeec2636592dd92d0 Log: [FIXED JENKINS-9168] Added --progress to git clone.

          dogfood added a comment -

          Integrated in plugins_git-plugin #116
          [FIXED JENKINS-9168] Added --progress to git clone.

          Andrew Bayer : aa753c3b736d7e3759b9a7aeeec2636592dd92d0
          Files :

          • src/main/java/hudson/plugins/git/GitAPI.java

          dogfood added a comment - Integrated in plugins_git-plugin #116 [FIXED JENKINS-9168] Added --progress to git clone. Andrew Bayer : aa753c3b736d7e3759b9a7aeeec2636592dd92d0 Files : src/main/java/hudson/plugins/git/GitAPI.java

            abayer Andrew Bayer
            kohsuke Kohsuke Kawaguchi
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: