Apache httpd error.log spammed with "Use of uninitialized value" warnings

Hello,
we are using RT-Version 4.4.6 on Red-Hat 7.
Although the warnings in the log are known for a long time, our “/var/log/httpd/error.log” suddenly fills rapidly with warnings like

Mär 02 15:25:36 host.some.lan RT[19973]: [19973] Use of uninitialized value $ptag in string eq at /opt/perl5/perls/perl-5.20.3/lib/site_perl/5.20.3/HTML/Element.pm line 711.
Mär 02 15:25:36 host.some.lan RT[19973]: [19973] Use of uninitialized value $ptag in hash element at /opt/perl5/perls/perl-5.20.3/lib/site_perl/5.20.3/HTML/Element.pm line 711.

The code around line 711:

708     my (@to_do) = ( $_[0] );    # Start off.
709     my ( $i, $sibs, $ptag, $this );    # scratch for the loop...
710     while (@to_do) {
711         if (   ( $ptag = ( $this = shift @to_do )->{'_tag'} ) eq 'pre'
712             or $ptag eq 'textarea'
713             or $HTML::Tagset::isCDATA_Parent{$ptag} )
714         {
715 
716             # block the traversal under those
717             print "Blocking traversal under $ptag\n" if $Debug;
718             next;
719         }

There is a third warning like:

Mär 02 15:25:07 host.some.lan RT[19496]: [19496] Use of uninitialized value in string eq at /opt/perl5/perls/perl-5.20.3/lib/site_perl/5.20.3/HTML/Element.pm line 2220.

The code around line 2220:

2214 sub simplify_pres {
2215 my $pre = 0;
2216
2217 my $sub;
2218 my $line;
2219 $sub = sub {
2220 ++$pre if $[0]->{'tag’} eq ‘pre’;
2221 foreach my $it ( @{ $
[0]->{'content’} || return } ) {
2222 if ( ref $it ) {
2223 $sub->($it); # recurse!
2224 }
2225 elsif ($pre) {
2226
2227 #$it =~ s/(?:(?:\cm\cj*)|(?:\cj))/\n/g;
2228
2229 $it = join “\n”, map {
2230 ;
2231 $line = $
;
2232 while (
2233 $line
2234 =~ s/^([^\t])(\t+)/$1.(" " x ((length($2)<<3)-(length($1)&7)))/e
2235
2236 # Sort of adapted from Text::Tabs – yes, it’s hardwired-in that
2237 # tabs are at every EIGHTH column.
2238 )
2239 {
2240 }
2241 $line;
2242 }
2243 split /(?:(?:\cm\cj
)|(?:\cj))/, $it, -1;
2244 }
2245 }
2246 --$pre if $
[0]->{'tag’} eq ‘pre’;
2247 return;
2248 };
2249 $sub->( $
[0] );

I see that “$pre” is initialized with “*my $pre = 0”. But all “uninitialized string” warnings contain that “eq ‘pre’”. Over the weekend the logfile grew to 24 GB, maybe someone can push me in the right direction what is wrong here.
Thanks in advance.

mb

I don’t know what the cause of this sudden increase is for you, but see if there is a use warnings; at top of the script. Commenting that out may stop Perl complaining about them.

Longer term, it might be better if RT had a default to an empty string if the comparison string isn’t defined for whatever reason. So for example the assign-compare on line 711-714 could instead be:

if (   ( $ptag = ( $this = shift @to_do )->{'_tag'} // '' ) eq 'pre'
    or $ptag eq 'textarea'
    or $HTML::Tagset::isCDATA_Parent{$ptag} )
{
...
}

@GreenJimll
Thanks for the quick reply. I managed to let logrotate do a daily job and clean things up.

I am working on a new VM for RT with version 5. I would love to avoid moving such an explosive error (or “warning”) to a new host. Still interested in the cause of these warnings.

The reason for the spam in “error.log” were some mails in a queue-mailbox generated from “PRTG-Monitoring” and sent via an on-premise Exchange-Server. It seems RT can not parse them and delete them from the mailbox. So they are polled forever and forever throwing errors.
Thanks for hosting my problem.

mb