mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-23 14:00:03 +02:00
Avoid unexpected panic in graceful manager (#29629)
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" If there are some mistakes in the app.ini, end users would just see the "panic", but not the real error messages. A real case: #27643 This PR is just a quick fix for the annoying panic problem. (cherry picked from commit 90a3f2d4b7ed3890d9655c0334444f86d89b7b30)
This commit is contained in:
parent
ee4443c998
commit
a8f5449cd9
2 changed files with 18 additions and 2 deletions
|
@ -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()
|
||||
}()
|
||||
g.createServerWaitGroup.Wait()
|
||||
}()
|
||||
}()
|
||||
if limit > 0 {
|
||||
select {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue