From 410bde60095d39d9e976277addabd400ed667901 Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Fri, 18 Jun 2021 15:28:58 +0200 Subject: [PATCH] Fix race condition in TestPipelineClientIssue832 --- client_test.go | 5 +++-- server_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client_test.go b/client_test.go index 5c00809d6c..9775ba0f00 100644 --- a/client_test.go +++ b/client_test.go @@ -126,11 +126,12 @@ func TestPipelineClientIssue832(t *testing.T) { ln := fasthttputil.NewInmemoryListener() req := AcquireRequest() - defer ReleaseRequest(req) + // Don't defer ReleaseRequest as we use it in a goroutine that might not be done at the end. + req.SetHost("example.com") res := AcquireResponse() - defer ReleaseResponse(res) + // Don't defer ReleaseResponse as we use it in a goroutine that might not be done at the end. client := PipelineClient{ Dial: func(addr string) (net.Conn, error) { diff --git a/server_test.go b/server_test.go index af1d63d25f..928bebce26 100644 --- a/server_test.go +++ b/server_test.go @@ -1766,7 +1766,7 @@ func TestServerContinueHandler(t *testing.T) { if err != nil { t.Fatalf("Unexpected error from serveConn: %s", err) } - case <-time.After(100 * time.Millisecond): + case <-time.After(200 * time.Millisecond): t.Fatal("timeout") }