Close the gofer socket gracefully in boot:boot_test.
We were closing the FD directly. If the test then created a new socket pair with the same FD, in-flight RPCs would get directed to the new socket and break the test. Instead, we should use unet.Socket.Close(), which allows any in-flight RPCs to finish. PiperOrigin-RevId: 217608491 Change-Id: I8c5a76638899ba30f33ca976e6fac967fa0aadbf
This commit is contained in:
parent
b2a88ff471
commit
e0bb94201f
|
@ -84,8 +84,13 @@ func startGofer(root string) (int, func(), error) {
|
|||
log.Infof("Gofer is stopping. FD: %d, err: %v\n", goferEnd, err)
|
||||
}
|
||||
}()
|
||||
// Closing the gofer FD will stop the gofer and exit goroutine above.
|
||||
return sandboxEnd, func() { syscall.Close(goferEnd) }, nil
|
||||
// Closing the gofer socket will stop the gofer and exit goroutine above.
|
||||
cleanup := func() {
|
||||
if err := socket.Close(); err != nil {
|
||||
log.Warningf("Error closing gofer socket: %v", err)
|
||||
}
|
||||
}
|
||||
return sandboxEnd, cleanup, nil
|
||||
}
|
||||
|
||||
func createLoader() (*Loader, func(), error) {
|
||||
|
|
Loading…
Reference in New Issue