mirror of
https://github.com/php/frankenphp.git
synced 2026-03-23 16:42:13 +01:00
fix: prevent segfault on early shutdown. (#2120)
Fixes #2114
This early
[Shutdown](11160fb7b3/frankenphp.go (L281))
introduced in #2031 segfaults instead of returning an error since
threads have not started yet.
This commit is contained in:
committed by
GitHub
parent
11160fb7b3
commit
ecad5ec0a0
@@ -79,6 +79,9 @@ func initPHPThreads(numThreads int, numMaxThreads int, phpIni map[string]string)
|
||||
}
|
||||
|
||||
func drainPHPThreads() {
|
||||
if mainThread == nil {
|
||||
return // mainThread was never initialized
|
||||
}
|
||||
doneWG := sync.WaitGroup{}
|
||||
doneWG.Add(len(phpThreads))
|
||||
mainThread.state.Set(state.ShuttingDown)
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestTransitionThreadsWhileDoingRequests(t *testing.T) {
|
||||
|
||||
var (
|
||||
isDone atomic.Bool
|
||||
wg sync.WaitGroup
|
||||
wg sync.WaitGroup
|
||||
)
|
||||
|
||||
numThreads := 10
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type hotReloadOpt struct {
|
||||
hotReload []*watcher.PatternGroup
|
||||
hotReload []*watcher.PatternGroup
|
||||
}
|
||||
|
||||
var restartWorkers atomic.Bool
|
||||
|
||||
Reference in New Issue
Block a user