From ec15a4056a8f53352bb6189ddd6fad4d8f9e96f2 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 8 May 2024 18:14:17 -0700 Subject: [PATCH 1/2] Use the latest libswsscommon artifacts from the repo For libswsscommon, instead of getting the artifacts from the sonic-buildimage repo, get it from the sonic-swss-common repo instead. The version in sonic-buildimage might be behind because the submodule update hasn't happened. That way, it's testing with the latest code, and also matches the go compilation where it uses the latest of sonic-swss-common. Signed-off-by: Saikrishna Arcot --- azure-pipelines.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 83bfdc37..1b99822d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -82,8 +82,6 @@ stages: patterns: | target/debs/bookworm/libyang*.deb target/debs/bookworm/libnl*.deb - target/debs/bookworm/libswsscommon*.deb - target/debs/bookworm/python3-swsscommon*.deb target/python-wheels/bookworm/sonic_yang_models*.whl displayName: "Download bookworm debs" @@ -124,14 +122,26 @@ stages: curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - sudo apt-add-repository https://packages.microsoft.com/debian/12/prod sudo apt-get update - sudo apt-get install -y dotnet-sdk-7.0 + sudo apt-get install -y dotnet-sdk-8.0 displayName: "Install .NET CORE" + - task: DownloadPipelineArtifact@2 + inputs: + source: specific + project: build + pipeline: Azure.sonic-swss-common + artifact: sonic-swss-common-bookworm + runVersion: 'latestFromBranch' + runBranch: 'refs/heads/$(BUILD_BRANCH)' + displayName: "Download sonic-swss-common" + - script: | + set -ex # LIBSWSSCOMMON - sudo dpkg -i ../target/debs/bookworm/libswsscommon_1.0.0_amd64.deb - sudo dpkg -i ../target/debs/bookworm/libswsscommon-dev_1.0.0_amd64.deb - sudo dpkg -i ../target/debs/bookworm/python3-swsscommon_1.0.0_amd64.deb + sudo dpkg -i libswsscommon_1.0.0_amd64.deb + sudo dpkg -i libswsscommon-dev_1.0.0_amd64.deb + sudo dpkg -i python3-swsscommon_1.0.0_amd64.deb + workingDirectory: $(Pipeline.Workspace)/ displayName: 'Install libswsscommon package' - script: | From d442e7a6cf3c7b9d1781752cf4bda213d11aa40a Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Thu, 9 May 2024 14:07:37 +0800 Subject: [PATCH 2/2] Fix memory leak in unit test (#235) Why I did it Found memory leak in mixed_db_client test case. How I did it Delete global variable in unit test. How to verify it Manually test. --- sonic_data_client/client_test.go | 10 ++++++++++ sonic_data_client/mixed_db_client.go | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sonic_data_client/client_test.go b/sonic_data_client/client_test.go index bd56cb81..4c199660 100644 --- a/sonic_data_client/client_test.go +++ b/sonic_data_client/client_test.go @@ -448,9 +448,15 @@ func TestZmqReconnect(t *testing.T) { t.Errorf("Receive data from ZMQ failed") } + client.Close() swsscommon.DeleteZmqConsumerStateTable(consumer) + swsscommon.DeleteZmqClient(client.zmqClient) swsscommon.DeleteZmqServer(zmqServer) swsscommon.DeleteDBConnector(db) + + for _, client := range zmqClientMap { + swsscommon.DeleteZmqClient(client) + } } func TestRetryHelper(t *testing.T) { @@ -613,4 +619,8 @@ func TestGetZmqClient(t *testing.T) { swsscommon.DeleteTable(dpusTable) swsscommon.DeleteTable(dhcpPortTable) swsscommon.DeleteDBConnector(configDb) + + for _, client := range zmqClientMap { + swsscommon.DeleteZmqClient(client) + } } diff --git a/sonic_data_client/mixed_db_client.go b/sonic_data_client/mixed_db_client.go index e87d3c51..f748a576 100644 --- a/sonic_data_client/mixed_db_client.go +++ b/sonic_data_client/mixed_db_client.go @@ -1548,10 +1548,6 @@ func (c *MixedDbClient) Close() error { swsscommon.DeleteSonicDBKey(c.dbkey) } - for _, client := range zmqClientMap { - swsscommon.DeleteZmqClient(client) - } - return nil }