]> source.dussan.org Git - gitea.git/commitdiff
Ensure that graceful start-up is informed of unused SSH listener (#20877)
authorJonRB <4564448+eeyrjmr@users.noreply.github.com>
Sun, 21 Aug 2022 12:18:22 +0000 (13:18 +0100)
committerGitHub <noreply@github.com>
Sun, 21 Aug 2022 12:18:22 +0000 (20:18 +0800)
The graceful manager waits for 4 listeners to be created or to be told that they are not needed. If it is not told about them it will indefinitely and timeout.

This leads to SVC hosts not being told of being in the readyState but on Unix would lead to the termination of the process.

There was an unfortunate regression in #20299 which missed this subtly and in the case whereby SSH is disabled the `builtinUnused()` is not called.

This PR adds a call to `builtinUnused()` when not using the builtin ssh to allow `createServerWaitGroup.Done()` to be called.

In addition it was noted that the if/else clauses for timeout informing of the SVC host were in the wrong order. These have been swapped.

Fix #20609

modules/graceful/manager_windows.go
modules/ssh/init.go

index e7e619f53f61794b22069af15cd2e260f8090856..10c1d67b97204d9bb7e8a2870ec836b485cef074 100644 (file)
@@ -114,9 +114,9 @@ func (g *Manager) start() {
 // Execute makes Manager implement svc.Handler
 func (g *Manager) Execute(args []string, changes <-chan svc.ChangeRequest, status chan<- svc.Status) (svcSpecificEC bool, exitCode uint32) {
        if setting.StartupTimeout > 0 {
-               status <- svc.Status{State: svc.StartPending}
-       } else {
                status <- svc.Status{State: svc.StartPending, WaitHint: uint32(setting.StartupTimeout / time.Millisecond)}
+       } else {
+               status <- svc.Status{State: svc.StartPending}
        }
 
        log.Trace("Awaiting server start-up")
index f6332bb18b7243ac49faeae835fabad66201f527..72cb6df7a43c652742de7cae995d3c1e579238d1 100644 (file)
@@ -18,6 +18,7 @@ import (
 
 func Init() error {
        if setting.SSH.Disabled {
+               builtinUnused()
                return nil
        }