Skip to content

Commit

Permalink
Ensure that graceful start-up is informed of unused SSH listener (go-…
Browse files Browse the repository at this point in the history
…gitea#20877)

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 go-gitea#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 go-gitea#20609
  • Loading branch information
eeyrjmr authored Aug 21, 2022
1 parent c61ed6f commit eee51d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/graceful/manager_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions modules/ssh/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

func Init() error {
if setting.SSH.Disabled {
builtinUnused()
return nil
}

Expand Down

0 comments on commit eee51d8

Please sign in to comment.