Fail loudly on a touch read, stop the workers before their sockets close, and file down the small edges
This commit is contained in:
@@ -640,6 +640,20 @@ func run(aName, bName string, nsPerM float64) error {
|
||||
defer wg.Done()
|
||||
samp.run(&done, startTx)
|
||||
}()
|
||||
// Every return from here on stops the workers before the deferred closes
|
||||
// pull their sockets out from under them: otherwise the sampler panics on a
|
||||
// closed fd and can mask the error that actually ended the run. An error
|
||||
// before the gate opens closes it here, or the wait would hang on
|
||||
// goroutines still parked at startTx.
|
||||
defer func() {
|
||||
done.Store(true)
|
||||
select {
|
||||
case <-startTx:
|
||||
default:
|
||||
close(startTx)
|
||||
}
|
||||
wg.Wait()
|
||||
}()
|
||||
rxReady.Wait()
|
||||
|
||||
sig := make(chan os.Signal, 1)
|
||||
@@ -674,8 +688,6 @@ func run(aName, bName string, nsPerM float64) error {
|
||||
for {
|
||||
select {
|
||||
case <-sig:
|
||||
done.Store(true)
|
||||
wg.Wait()
|
||||
return nil
|
||||
case <-space:
|
||||
start = resetAll(dirs, stats)
|
||||
|
||||
Reference in New Issue
Block a user