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