From patchwork Tue Jul 26 20:08:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 652900 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rzThf0xvHz9stY for ; Wed, 27 Jul 2016 06:08:34 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 5C484102C2; Tue, 26 Jul 2016 13:08:32 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 4375F102AA for ; Tue, 26 Jul 2016 13:08:31 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id C2C7516213F for ; Tue, 26 Jul 2016 14:08:30 -0600 (MDT) X-ASG-Debug-ID: 1469563710-0b323747751dc10001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar6.cudamail.com with ESMTP id zbeNC3ApGLKl5e44 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 26 Jul 2016 14:08:30 -0600 (MDT) X-Barracuda-Envelope-From: azhou.ovn@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pf0-f193.google.com) (209.85.192.193) by mx1-pf1.cudamail.com with ESMTPS (AES128-SHA encrypted); 26 Jul 2016 20:08:29 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.192.193 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.85.192.193 X-Barracuda-RBL-IP: 209.85.192.193 Received: by mail-pf0-f193.google.com with SMTP id h186so481729pfg.2 for ; Tue, 26 Jul 2016 13:08:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Zjpmhlt2gTET1ExVVqt/PSPdLMbh5Jj2Vn9P+xQv9t0=; b=C4Xi4+NoFJvlKdjtM/kBmQ62YsCk8XVSnUsvbnaNEBSp1gg6FbC1/yJNkeY7AqokDe seEyqdqr/ooxnwX8iMpwtXL2gJJG9bCUuiZnbLK1oYRF1csuXRciPaxRDOQbdVMXugkX v7tEmnRT+053F4tCyBps5pZRwVN1TaHh5+RES1xvoaEjiTCPMlS3hPow0kmAi6ZN3VS5 o7XNJZ8HvjTrZKFsBruzFK+wtEOoe9bGlEmmKJItp59y1XIjnHo2dYZzpvWDTLDafp95 nqufEU6MRZENvV6j8yDqX3aR9d4Hy+o7AQTux+eo/PLIOztHz4kA2t7dq/qMHNyXGuCD z8BQ== X-Gm-Message-State: AEkooutzxpCymvyCfQ5tU5CvxpQvhhpa4gllHcyWGHJsjsWQZQS5/4TGvy/laHtCeIsUcA== X-Received: by 10.98.24.194 with SMTP id 185mr42703583pfy.52.1469563709054; Tue, 26 Jul 2016 13:08:29 -0700 (PDT) Received: from ubuntu.localdomain ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id t80sm3513610pfj.38.2016.07.26.13.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jul 2016 13:08:27 -0700 (PDT) X-CudaMail-Envelope-Sender: azhou.ovn@gmail.com From: Andy Zhou To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-725067919 X-CudaMail-DTE: 072616 X-CudaMail-Originating-IP: 209.85.192.193 Date: Tue, 26 Jul 2016 13:08:05 -0700 X-ASG-Orig-Subj: [##CM-E1-725067919##][PATCH 1/3] ovsdb: Properly close replication rpc connection Message-Id: <1469563687-5352-1-git-send-email-azhou@ovn.org> X-Mailer: git-send-email 1.9.1 X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1469563710 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 1/3] ovsdb: Properly close replication rpc connection X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This patch removes rpc related memory leak reported below. Reported-at: http://openvswitch.org/pipermail/dev/2016-July/076075.html Signed-off-by: Andy Zhou Acked-by: William Tu --- ovsdb/ovsdb-server.c | 1 + ovsdb/replication.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 239cca8..1c6ddca 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -202,6 +202,7 @@ main_loop(struct ovsdb_jsonrpc_server *jsonrpc, struct shash *all_dbs, } } + disconnect_remote_server(); free(remotes_error); } diff --git a/ovsdb/replication.c b/ovsdb/replication.c index 52b7085..3d589ef 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -32,8 +32,8 @@ #include "table.h" #include "transaction.h" -static char *remote_ovsdb_server; -static struct jsonrpc *rpc; +static char *remote_ovsdb_server = NULL; +static struct jsonrpc *rpc = NULL; static struct sset monitored_tables = SSET_INITIALIZER(&monitored_tables); static struct sset tables_blacklist = SSET_INITIALIZER(&tables_blacklist); static bool reset_dbs = true; @@ -391,6 +391,7 @@ check_for_notifications(struct shash *all_dbs) if (error == EAGAIN) { return; } else if (error) { + jsonrpc_close(rpc); rpc = open_jsonrpc(remote_ovsdb_server); if (!rpc) { /* Remote server went down. */