1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:04:45 -07:00

net: don't block forever in splice test cleanup on failure

The ppc64x builders are failing on the new splice test from CL 113997
but the actual failure is being obscured by a test deadlock.

Change-Id: I7747f88bcdba9776a3c0d2f5066cfec572706108
Reviewed-on: https://go-review.googlesource.com/133417
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Brad Fitzpatrick 2018-09-05 13:34:25 +00:00
parent 5789f838be
commit 81957dd58e

View File

@ -15,6 +15,7 @@ import (
"strconv"
"sync"
"testing"
"time"
)
func TestSplice(t *testing.T) {
@ -332,7 +333,19 @@ func startSpliceClient(conn Conn, op string, chunkSize, totalSize int) (func(),
close(donec)
}()
return func() { <-donec }, nil
return func() {
select {
case <-donec:
case <-time.After(5 * time.Second):
log.Printf("killing splice client after 5 second shutdown timeout")
cmd.Process.Kill()
select {
case <-donec:
case <-time.After(5 * time.Second):
log.Printf("splice client didn't die after 10 seconds")
}
}
}, nil
}
func init() {