From f6c13424fa9a22b5cddbe2b59fc33c74b7160aee Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Fri, 27 Jun 2025 13:43:09 +0200 Subject: [PATCH] hs-test: h2 memory leak test Type: test Change-Id: Ib68aabecafc4e17acae9942b6791d4aeb4833f96 Signed-off-by: Matus Fabian --- extras/hs-test/http2_test.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/extras/hs-test/http2_test.go b/extras/hs-test/http2_test.go index b1d7c6fcb43..a46da7a5427 100644 --- a/extras/hs-test/http2_test.go +++ b/extras/hs-test/http2_test.go @@ -10,7 +10,7 @@ import ( ) func init() { - RegisterH2Tests(Http2TcpGetTest, Http2TcpPostTest, Http2MultiplexingTest, Http2TlsTest, Http2ContinuationTxTest) + RegisterH2Tests(Http2TcpGetTest, Http2TcpPostTest, Http2MultiplexingTest, Http2TlsTest, Http2ContinuationTxTest, Http2ServerMemLeakTest) RegisterH2MWTests(Http2MultiplexingMWTest) } @@ -122,3 +122,36 @@ func Http2ContinuationTxTest(s *Http2Suite) { s.AssertNil(err, fmt.Sprint(err)) s.AssertGreaterThan(sizeHeader, 32768) } + +func Http2ServerMemLeakTest(s *H2Suite) { + s.SkipUnlessLeakCheck() + + vpp := s.Containers.Vpp.VppInstance + serverAddress := s.VppAddr() + ":" + s.Ports.Port1 + vpp.Vppctl("http cli server uri http://" + serverAddress) + target := fmt.Sprintf("http://%s/show/version", serverAddress) + + /* no goVPP less noise */ + vpp.Disconnect() + + /* warmup request (FIB) */ + args := fmt.Sprintf("--max-time 10 --noproxy '*' --http2-prior-knowledge -z %s %s %s %s", target, target, target, target) + _, log := s.RunCurlContainer(s.Containers.Curl, args) + s.AssertContains(log, "HTTP/2 200") + + vpp.EnableMemoryTrace() + traces1, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + + for i := 0; i < 10; i++ { + time.Sleep(time.Second * 1) + s.AssertNil(s.Containers.Curl.Start()) + } + + /* let's give it some time to clean up sessions */ + time.Sleep(time.Second * 15) + + traces2, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + vpp.MemLeakCheck(traces1, traces2) +} -- 2.16.6