diff options
author | zeripath <art27@cantab.net> | 2022-06-03 15:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 15:36:18 +0100 |
commit | 1d04e8641d4abab6ce978bc2dc5523c2ddb2f628 (patch) | |
tree | 742564159535d13dd060074187be79616da2bb3f /cmd | |
parent | 085924b1b370310c989fa5e75bb33323746382b0 (diff) | |
download | gitea-1d04e8641d4abab6ce978bc2dc5523c2ddb2f628.tar.gz gitea-1d04e8641d4abab6ce978bc2dc5523c2ddb2f628.zip |
Set Setpgid on child git processes (#19865)
When Gitea is running as PID 1 git will occassionally orphan child processes leading
to (defunct) processes. This PR simply sets Setpgid to true on these child processes
meaning that these defunct processes will also be correctly reaped.
Fix #19077
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/serv.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index adfbc6024c..6ba3e9de01 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -24,6 +24,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/pprof" "code.gitea.io/gitea/modules/private" + "code.gitea.io/gitea/modules/process" repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/lfs" @@ -306,6 +307,7 @@ func runServ(c *cli.Context) error { } } + process.SetSysProcAttribute(gitcmd) gitcmd.Dir = setting.RepoRootPath gitcmd.Stdout = os.Stdout gitcmd.Stdin = os.Stdin |