Re: autolearn_status error Ubuntu 18.04 LTS

Robert LeBlanc <[email protected]>
Newsgroups gmane.mail.virus.maiamailguard
Message-ID <[email protected]>
I don’t recall that autolearn_status was ever used in an actionable sense by Maia except as a bit of information (provided by SpamAssassin) passed along for logging and diagnostics purposes.

Basically it’s just a report from SpamAssassin about whether SA made any automatic alterations to its Bayes database as a result of scanning a mail item and applying the $autolearn_ham_threshold and $autolearn_spam_threshold values defined in maia.conf.  (If those threshold values are left undefined, autolearning is disabled.)

Typical results were “ham”,  “spam”, and “no” for earlier versions of SA, and newer versions added “disabled”, “failed”, and “unavailable”.  You’d see these appear in the log entries, e.g.

Maia: [record_tests] Assigning mail item 12345 a final score of 6.250, autolearn status = ’spam'

Note that if you send the same email through SA a second time it will report an autolearn status of ’no’, because no Bayes changes were needed.

In that sense it’s not a reliable indicator of what SA thought of the mail item, so it should not be used as such, but it can be useful for determining whether the autolearning mechanism (of SA) is working or not, and whether it was applied to a given mail item, when $autolearn_ham_threshold and $autolearn_spam_threshold are defined.

The storage of that reported value in the maia_mail table is just for keeping it available to display in logs and diagnostic outputs.

That said, if maiad is throwing errors due to trying to write a NULL to that field (rather than a text string), that might hint that SA’s return value was something unexpected.  Perhaps the SA folks in newer versions have changed the output format.

In maiad, check the maia_record_tests() subroutine for a line like:

$autolearn_status = validate($autolearn_status, '^([a-z]{2,15})$', 'si');

That regex is expecting a string of between 2 and 15 alphabetical characters (case-insensitive).  If the return value from SA doesn’t match that pattern, $autolearn_status will be undefined, and maia_record_tests() will try to write a NULL to maia_mail.autolearn_status column.

To debug, try running the email in question through SA directly, with the -D flag and see what it’s logging as ‘autolearn status =‘.  It may be that a newer version of SA is outputting a string longer than 15 characters, or that they’ve changed things to condense the status into a single character, or switched to using a numeric result code, any of which would break that validation regex.  Tweak the regex accordingly to fix the problem.

Rob

> On May 17, 2020, at 10:25 AM, jjs - mainphrame <[email protected]> wrote:
> 
> There's something about this autolearn_status issue that's nagging at me. >From what i can see, it was supposed to work in conjunction with bayes training and spam reporting, but for some reason that field is getting set to null.
> 
> I'm going to have to dig deeper, and try to find out where we went off the rails. My guess is that at one point this field was being used, but somehow fell through the cracks at some point.
> 
> The process-quarantine script contains 7 mentions of that parameter, e.g:
> 
>     #   List any confirmed spam (C), confirmed ham (G),
>     #   autolearnable spam (S), and autolearnable ham (H),
>     #   filtered by the $spamonly and $hamonly flags.
>     my $query = <<EOQ;
> SELECT maia_mail.id <http://maia_mail.id/>,
>        maia_mail_recipients.recipient_id,
>        maia_mail_recipients.type,
>        maia_mail.size,
>        maia_mail.score,
>        maia_mail.autolearn_status
> FROM   maia_mail, maia_mail_recipients
> WHERE  maia_mail.id <http://maia_mail.id/> = maia_mail_recipients.mail_id
> EOQ
> 
> Related parameters appear in maia.conf:
> --
> # If Bayes training is enabled, automatically learn items
> # with extreme scores, even without user confirmation.
> # Set these values conservatively, or undef to disable.
> 
> $autolearn_ham_threshold = undef;   # e.g. -5
> $autolearn_spam_threshold = undef;  # e.g. 10
> --
> 
> In any case, I'm looking to recover lost functionality. If any maia gurus remember how it used to work, your insights would be welcome.
> 
> Jake
> 
> 
> On Tue, May 12, 2020 at 8:36 AM <[email protected] <mailto:[email protected]>> wrote:
> Hello Everyone,
> 
> I've been out of the loop for a long while and decided to try the latest build using the install script on Ubuntu 18.04 LTS. Everything seemed to go along just fine and I am testing with a domain and getting the following error.
> 
> May 12 14:04:59 maia postfix/lmtp[33612]: EECC1859E0: to=<[email protected] <mailto:[email protected]>>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.35, delays=0.22/0/0/0.12, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 Error in processing, id=21314-03, Take Action! FAILED: DBD::mysql::st execute failed: Column 'autolearn_status' cannot be null at /var/lib/maia/maiad line 4408, <GEN20> line 156. (in reply to end of DATA command))
> 
> The Maia server is at the head end, the user account was created in the web interface and there is a transport file and relay_domain mappings file to the recipient email server.
> 
> Seems like its something minor but A google search isn’t helping me out
> 
> Thanks,
> Dave
> 
> 
> _______________________________________________
> Maia-users mailing list
> [email protected] <mailto:[email protected]>
> http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
> _______________________________________________
> Maia-users mailing list
> [email protected]
> http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users

_______________________________________________
Maia-users mailing list
[email protected]
http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQSBR6OyClV7nkt4Wjkaao4RHY0d7AUCXsGg1wAKCRAaao4RHY0d
7ODBAJ0bQ9pvJL33UjAoVhoYtVEPlmk2UwCfb5HkDtO3Rv/T8feDr9W8zJoTXc0=
=cZi6
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.