container: spin instead of block on wait4 ECHILD
All checks were successful
Test / Create distribution (push) Successful in 36s
Test / Sandbox (push) Successful in 2m44s
Test / Sandbox (race detector) (push) Successful in 4m43s
Test / Hpkg (push) Successful in 4m57s
Test / Hakurei (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m27s
Test / Flake checks (push) Successful in 1m27s
All checks were successful
Test / Create distribution (push) Successful in 36s
Test / Sandbox (push) Successful in 2m44s
Test / Sandbox (race detector) (push) Successful in 4m43s
Test / Hpkg (push) Successful in 4m57s
Test / Hakurei (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m27s
Test / Flake checks (push) Successful in 1m27s
Blocking prevents further wait4 processing causing ops to never receive their signals. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
96dd7abd80
commit
dafe9f8efc
@ -11,6 +11,7 @@ import (
|
||||
"slices"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
. "syscall"
|
||||
"time"
|
||||
|
||||
@ -368,8 +369,8 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) {
|
||||
// when there are no longer any processes left to reap
|
||||
info := make(chan winfo, 1)
|
||||
|
||||
// closed when the initial process has started
|
||||
initialProcessStarted := make(chan struct{})
|
||||
// whether initial process has started
|
||||
var initialProcessStarted atomic.Bool
|
||||
|
||||
k.new(func(k syscallDispatcher) {
|
||||
k.lockOSThread()
|
||||
@ -413,11 +414,10 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) {
|
||||
|
||||
if !errors.Is(err, ECHILD) {
|
||||
k.printf(msg, "unexpected wait4 response: %v", err)
|
||||
} else if initialProcessStarted != nil {
|
||||
} else if !initialProcessStarted.Load() {
|
||||
// initial process has not yet been reached and all daemons
|
||||
// terminated or none were started in the first place
|
||||
<-initialProcessStarted
|
||||
initialProcessStarted = nil
|
||||
time.Sleep(500 * time.Microsecond)
|
||||
goto wait4
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) {
|
||||
if err := k.start(cmd); err != nil {
|
||||
k.fatalf(msg, "%v", err)
|
||||
}
|
||||
close(initialProcessStarted)
|
||||
initialProcessStarted.Store(true)
|
||||
|
||||
// handle signals to dump withheld messages
|
||||
sig := make(chan os.Signal, 2)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user