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 ( ...@@ -14,6 +14,7 @@ import (
"os/exec" "os/exec"
"path" "path"
"path/filepath" "path/filepath"
"syscall"
"time" "time"
) )
...@@ -79,6 +80,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) { ...@@ -79,6 +80,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
stdout = archiveStdout stdout = archiveStdout
} else { } else {
compressCmd.Stdin = archiveStdout compressCmd.Stdin = archiveStdout
compressCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
stdout, err = compressCmd.StdoutPipe() stdout, err = compressCmd.StdoutPipe()
if err != nil { if err != nil {
...@@ -91,7 +93,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) { ...@@ -91,7 +93,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
fail500(w, fmt.Errorf("handleGetArchive: start %v: %v", compressCmd.Args, err)) fail500(w, fmt.Errorf("handleGetArchive: start %v: %v", compressCmd.Args, err))
return return
} }
defer compressCmd.Wait() defer cleanUpProcessGroup(compressCmd)
archiveStdout.Close() 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