Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Mar 6, 2024
1 parent a4bcfb8 commit 7fe867e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion modules/graceful/manager_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ func (g *Manager) start() {
go func() {
defer close(startupDone)
// Wait till we're done getting all the listeners and then close the unused ones
g.createServerWaitGroup.Wait()
func() {
// FIXME: there is a fundamental design problem of the "manager" and the "wait group".
// If nothing has started, the "Wait" just panics: sync: WaitGroup is reused before previous Wait has returned
// There is no clear solution besides a complete rewriting of the "manager"
defer func() {
recover()

Check failure on line 67 in modules/graceful/manager_unix.go

View workflow job for this annotation

GitHub Actions / lint-backend

Error return value is not checked (errcheck)

Check failure on line 67 in modules/graceful/manager_unix.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

Error return value is not checked (errcheck)
}()
g.createServerWaitGroup.Wait()
}()
// Ignore the error here there's not much we can do with it, they're logged in the CloseProvidedListeners function
_ = CloseProvidedListeners()
g.notify(readyMsg)
Expand Down
10 changes: 9 additions & 1 deletion modules/graceful/manager_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ func (g *Manager) awaitServer(limit time.Duration) bool {
c := make(chan struct{})
go func() {
defer close(c)
g.createServerWaitGroup.Wait()
func() {
// FIXME: there is a fundamental design problem of the "manager" and the "wait group".
// If nothing has started, the "Wait" just panics: sync: WaitGroup is reused before previous Wait has returned
// There is no clear solution besides a complete rewriting of the "manager"
defer func() {
recover()

Check failure on line 158 in modules/graceful/manager_windows.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

Error return value is not checked (errcheck)
}()
g.createServerWaitGroup.Wait()
}()
}()
if limit > 0 {
select {
Expand Down

0 comments on commit 7fe867e

Please sign in to comment.