Menu

#162 T10Stat counter never populated due to incorrect comparison operator in T10StatAdd()

ASSP V2
closed
None
2026-05-11
2026-05-05
No

Environment

  • ASSP version: 2.8.2(26034)
  • Perl: 5.038002
  • OS: Ubuntu Linux (linux x86_64)
  • DoT10Stat:=1 (enabled)

Problem Description

After enabling DoT10Stat, the Top Ten Statistics page (/top10stats)
remains empty in the GUI, even though spam is being blocked correctly
and the corresponding entries appear in maillog.txt.

The persistent counter files exist but stay at 1 byte (effectively empty):
-rw-r--r-- 1 assp assp 1 /usr/share/assp/tmpDB/files/T10StatD.sav
-rw-r--r-- 1 assp assp 1 /usr/share/assp/tmpDB/files/T10StatI.sav
-rw-r--r-- 1 assp assp 1 /usr/share/assp/tmpDB/files/T10StatR.sav
-rw-r--r-- 1 assp assp 1 /usr/share/assp/tmpDB/files/T10StatS.sav

The counters are never incremented, regardless of how many incoming
messages are blocked.

Root Cause

In sub T10StatAdd at line 55747 of assp.pl, the connection type
is compared using the numeric inequality operator != instead of
the string inequality operator ne:

sub T10StatAdd {
    my $fh = shift;
    return unless $fh;
    return if $Con{$fh}->{type} != 'C';        # <-- bug
    ...
}

Because 'C' evaluates to 0 in numeric context, the expression
$Con{$fh}->{type} != 'C' is always true (assuming type holds a
non-zero value or any non-numeric string), and the function returns
immediately for every call. As a result, no counters are ever
incremented and the Top Ten statistic stays empty.

This is also inconsistent with other places in assp.pl where the
same comparison is done correctly with ne, e.g.:
21855: if (Con{
fh}->{type} ne 'C' || ...
22282: if (SessionLog > 2 && $Con{
fh}->{type} ne 'C') {
22317: if (Con{
fh}->{type} ne 'C' && ...

Suggested Fix

Replace != with ne on line 55747:

return if $Con{$fh}->{type} ne 'C';

Verification

After applying the fix locally and restarting ASSP (using
--nointchk:=1 because of the integrity check), incoming blocked
mails are correctly counted and the Top Ten Statistics page
populates as expected.

Reverting the change reproduces the empty-statistic behaviour.

Thanks for ASSP and for looking into this.

Discussion

  • Thomas Eckardt

    Thomas Eckardt - 2026-05-09
    • status: open --> accepted
     
  • Thomas Eckardt

    Thomas Eckardt - 2026-05-09

    thank you,
    this will be fixed in the next release

    Thomas

     

    Last edit: Thomas Eckardt 2026-05-11
  • Thomas Eckardt

    Thomas Eckardt - 2026-05-11
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB