]> Cypherpunks repositories - gostls13.git/commitdiff
net: don't block forever in splice test cleanup on failure
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 5 Sep 2018 13:34:25 +0000 (13:34 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 5 Sep 2018 14:26:11 +0000 (14:26 +0000)
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>
src/net/splice_test.go

index 656c194094a958d6e11329fca3689e9636bf9713..93e8b1f8cc0a1d974ab1ebace01c1ef8b60ca095 100644 (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() {