andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From f5c16bca42573e21beeacd800841cd428108426b Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Mon, 18 Aug 2014 09:59:47 -0600
dc8c34
Subject: [PATCH 249/251] Ticket 47446 - logconv.pl memory continually grows
dc8c34
dc8c34
Bug Description:  Running logconv.pl without any special options
dc8c34
                  continually consumes more memory.
dc8c34
dc8c34
Fix Description:  The last fix introduced the use of regex matches which
dc8c34
                  caused the value of $1 to become undefined.  When using
dc8c34
                  all of the logconv cmd line switches, many undefined
dc8c34
                  variable warnings were printed.  This fix saves the value
dc8c34
                  of $1 in a local variable so that it it not undefined by
dc8c34
                  the use of subsequent regex matches.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47446
dc8c34
dc8c34
Reviewed by: mreynolds (Thanks!)
dc8c34
dc8c34
(cherry picked from commit c4f396db2484362ecb7a1c54458ad794b8d5c506)
dc8c34
(cherry picked from commit db9c4e73ab98a43bcbbd6a2ffe84d3ff2f103de5)
dc8c34
(cherry picked from commit 3be093105fe5525fd66ac055ff58d48fbd0f823a)
dc8c34
(cherry picked from commit 81e5f14fba9825d873b729fe74acfee6ac08e7bc)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 17 +++++++++++------
dc8c34
 1 file changed, 11 insertions(+), 6 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index edc5fd1..cd45a8b 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -1693,10 +1693,11 @@ sub parseLineNormal
dc8c34
 		$srchCount++;
dc8c34
 		if($reportStats){ inc_stats('srch',$s_stats,$m_stats); }
dc8c34
 		if ($_ =~ / attrs=\"(.*)\"/i){
dc8c34
+			my $attrlist = $1;
dc8c34
 			$anyAttrs++;
dc8c34
 			if ($usage =~ /r/i || $verb eq "yes"){
dc8c34
 				my $attr = $hashes->{attr};
dc8c34
-				map { $attr->{$_}++ } split /\s/, $1;
dc8c34
+				map { $attr->{$_}++ } split /\s/, $attrlist;
dc8c34
 			}
dc8c34
 		}
dc8c34
 		if (/ attrs=ALL/){
dc8c34
@@ -2131,8 +2132,9 @@ sub parseLineNormal
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if ($_ =~ /err= *([0-9]+)/i){
dc8c34
-		if ($usage =~ /e/i || $verb eq "yes"){ $errorCode[$1]++; }
dc8c34
-		if ($1 ne "0"){ $errorCount++;}
dc8c34
+		my $errcode = $1;
dc8c34
+		if ($usage =~ /e/i || $verb eq "yes"){ $errorCode[$errcode]++; }
dc8c34
+		if ($errcode ne "0"){ $errorCount++;}
dc8c34
 		else { $successCount++;}
dc8c34
 	}
dc8c34
 	if ($_ =~ /etime= *([0-9.]+)/ ) { 
dc8c34
@@ -2142,8 +2144,9 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
dc8c34
 		if ($_ =~ / nentries= *([0-9]+)/i ){ 
dc8c34
+			my $nents = $1;
dc8c34
 			if ($usage =~ /n/i || $verb eq "yes"){ 
dc8c34
-				$hashes->{nentries}->{$1}++; 
dc8c34
+				$hashes->{nentries}->{$nents}++; 
dc8c34
 			}
dc8c34
 		}
dc8c34
 	}
dc8c34
@@ -2152,10 +2155,12 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ EXT oid=/){
dc8c34
 		$extopCount++;
dc8c34
+		my $oid;
dc8c34
 		if ($_ =~ /oid=\" *([0-9\.]+)/i ){ 
dc8c34
-			if ($usage =~ /x/i || $verb eq "yes"){$hashes->{oid}->{$1}++; }
dc8c34
+			$oid = $1;
dc8c34
+			if ($usage =~ /x/i || $verb eq "yes"){$hashes->{oid}->{$oid}++; }
dc8c34
 		}
dc8c34
-		if ($1 && $1 eq $startTLSoid){$startTLSCount++;}
dc8c34
+		if ($oid && $oid eq $startTLSoid){$startTLSCount++;}
dc8c34
 		if ($verb eq "yes"){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{ext_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34