Commit 20eea011 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'archive-zombies' into 'master'

Prevent archive zombies

Interrupted archive downloads were creating zombies, see
https://gitlab.com/gitlab-org/gitlab-workhorse/issues/9

See merge request !25
parents 607825c5 8cb3a69a
......@@ -14,6 +14,7 @@ import (
"os/exec"
"path"
"path/filepath"
"syscall"
"time"
)
......@@ -79,6 +80,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
stdout = archiveStdout
} else {
compressCmd.Stdin = archiveStdout
compressCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
stdout, err = compressCmd.StdoutPipe()
if err != nil {
......@@ -91,7 +93,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
fail500(w, fmt.Errorf("handleGetArchive: start %v: %v", compressCmd.Args, err))
return
}
defer compressCmd.Wait()
defer cleanUpProcessGroup(compressCmd)
archiveStdout.Close()
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment