• Stan Hu's avatar
    Fix stalled HTTP fetches with large payloads · b8ab8bed
    Stan Hu authored
    For fetches over HTTP, Workhorse executes git-upload-pack and first
    attempts to send all the input data to stdin before reading from the
    stdout pipe. However, when the payload is large, the stdout pipe may
    fill up, causing git-upload-pack to stop reading from stdin. Workhorse
    will then be deadlocked, since it will be waiting to send more data
    to a buffer that will never be drained.
    
    An addition side effect is that git-upload-pack processes also get left
    around. These processes are cleaned up only after Workhorse is
    restarted.
    
    This fix modifies the git-upload-pack behavior to consume the entire
    HTTP input first so that reading the data from stdout and sending the
    reply can be performed in a separate Goroutine.
    
    Closes #92
    
    Closes gitlab-org/gitlab-ce#25916
    
    Closes gitlab-com/infrastructure#941
    b8ab8bed
git-http.go 7.51 KB