From patchwork Wed Dec 23 18:58:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 560684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id A0118140BA3 for ; Thu, 24 Dec 2015 05:58:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=TEk7U87Q; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id B546910BD4; Wed, 23 Dec 2015 10:58:27 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id ABE4D10B58 for ; Wed, 23 Dec 2015 10:58:26 -0800 (PST) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 2EAE44203B9 for ; Wed, 23 Dec 2015 11:58:26 -0700 (MST) X-ASG-Debug-ID: 1450897105-09eadd632c1f5af0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id 92vvoWJeg3T8mI4c (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 23 Dec 2015 11:58:25 -0700 (MST) X-Barracuda-Envelope-From: u9012063@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pf0-f173.google.com) (209.85.192.173) by mx1-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 23 Dec 2015 18:58:24 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.192.173 as permitted sender) X-Barracuda-RBL-Trusted-Forwarder: 209.85.192.173 Received: by mail-pf0-f173.google.com with SMTP id 65so11989925pff.3 for ; Wed, 23 Dec 2015 10:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=yEJ2bftr8gY5UM2RWCNnbuJUiGL97V8/h0mAHtBJ1Nw=; b=TEk7U87QFGNkIvbB0OxM6F+81aENnAQxCi5xtAOWSdu4NZlpNrsTSOzc7KOVMHei+2 vNm+m89wbJUkZTiTnSuSDu/TfK3/99DgaSj7tL++mq0DChkJqMfEf+IbqGrwRP/wKgSY 5UoW/PWGJtV5goyuKMHgLrGxt3YX2Egn+4H7bq1fVPlBKewVkRYW8uHDQJZuZHo5Zu/o r6QmU66Q2gb/RQx02SXkHUadDtgLe7Piv+egu0MWnWBIJmHrfabTR04qHv8oxHB70jou sSKGjF/CqM6p0V7WvMMt5mv2DYALYmLX3xBEcNES7sBQ2Fb7pSfna0NFpWYNQXw5C+GT 4Xbg== X-Received: by 10.98.87.144 with SMTP id i16mr22932852pfj.118.1450897104197; Wed, 23 Dec 2015 10:58:24 -0800 (PST) Received: from vm-dev.localdomain ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id uz4sm54246735pac.39.2015.12.23.10.58.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Dec 2015 10:58:23 -0800 (PST) X-CudaMail-Envelope-Sender: u9012063@gmail.com X-Barracuda-Apparent-Source-IP: 208.91.2.4 From: William Tu To: dev@openvswitch.org X-CudaMail-MID: CM-E1-1222062553 X-CudaMail-DTE: 122315 X-CudaMail-Originating-IP: 209.85.192.173 Date: Wed, 23 Dec 2015 10:58:15 -0800 X-ASG-Orig-Subj: [##CM-E1-1222062553##][PATCH] ovsdb: using perf counter without initialization Message-Id: <1450897095-35547-1-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.5.0 X-GBUdb-Analysis: 0, 209.85.192.173, Ugly c=0.443535 p=-0.351351 Source Normal X-MessageSniffer-Rules: 0-0-0-5084-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1450897105 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, DKIM_SIGNED, MAILTO_TO_SPAM_ADDR, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.25515 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.00 MAILTO_TO_SPAM_ADDR URI: Includes a link to a likely spammer email 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH] ovsdb: using perf counter without initialization 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" perf_counter_accumulate() is invoked without perf_counters_init() being called first, which leads to a memory leak reported by Valgrind (test cases 104, 106, and 107). A call trace is below: xmalloc (util.c:112) shash_add_nocopy__ (shash.c:109) shash_add_nocopy (shash.c:121) shash_add (shash.c:129) shash_add_once (shash.c:136) shash_add_assert (shash.c:146) perf_counter_init (perf-counter.c:86) perf_counter_accumulate (perf-counter.c:95) ovsdb_txn_commit (transaction.c:850) ovsdb_file_open__ (file.c:217) open_db (ovsdb-server.c:418) main (ovsdb-server.c:263) Signed-off-by: William Tu Signed-off-by: Daniele Di Proietto Co-authored-by: Daniele Di Proietto --- ovsdb/ovsdb-server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 25fa9c6..231ba2f 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -259,6 +259,9 @@ main(int argc, char *argv[]) shash_init(&all_dbs); server_config.all_dbs = &all_dbs; server_config.jsonrpc = jsonrpc; + + perf_counters_init(); + SSET_FOR_EACH (db_filename, &db_filenames) { error = open_db(&server_config, db_filename); if (error) { @@ -297,8 +300,6 @@ main(int argc, char *argv[]) daemonize_complete(); - perf_counters_init(); - if (!run_command) { /* ovsdb-server is usually a long-running process, in which case it * makes plenty of sense to log the version, but --run makes