Possible Method To Avoid Spamassasin Annoying Winsock Error

Use this forum for discussions about SpamAssassin and anti-spam in general.
Post Reply
User avatar
jim.bus
Senior user
Senior user
Posts: 941
Joined: 2011-05-28 11:49
Location: US

Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by jim.bus » 2022-01-11 10:42

I believe I have a possible solution as to how to avoid getting the annoying Spamassasin Winsock Error.

On 10-3-21, 10-10-21, and 10-11-21 I received the known recurring intermittent Spamassasin Winsock Error. This is not known to cause any great problem except for of course failing the Spamassin connection for the associated received email which means no results from Spamassasin as to whether or not the email message is Spam. Otherwise there is no impact.

Shortly after my 10-11-21 Winsock Error, I decided to try increaseing the 'Max number of asynchronous task threads' from the default of 15 to 20. I had noticed this value was related to the number of connections Spamassin could have from the Help Documentation and the Winsock Error is a connection error as reported in the Error Message. Picking 20 was just an arbitrary amount to increase the number to. I receive, in my opinion, a very small number of email messages on a daily basis. For instance, on 1-10-22 I had only 53 processed messages. My reasoning was to pick a small increase but enough to hopefully exceed the number of Task Threads I would need to avoid the Winsock Error. I usually get 2 to 3 Winsock Errors per month but it does vary but I haven't made note of exactly how many I did get on average prior to October.

I can report that after I increased the 'Max number of asynchronous task threads' to 20, I have not had any further Winsock Errors since 10-11-21 (3 months). Based on my observed results of NO WINSOCK ERRORS in 3 months, I'm guessing this may be a way to avoid getting the known Winsock Error. I would guess the 'Max number of asynchronous task threads' to choose would vary depending on the number of email messages one has to process at any given time. Therefore, I am posting this information for anyone who might care to use it themselves should this really be a solution.

User avatar
RvdH
Senior user
Senior user
Posts: 2026
Joined: 2008-06-27 14:42
Location: The Netherlands

Re: Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by RvdH » 2022-01-11 10:59

I read this in the other thread you posted this in, i can only confirm this for me this change does NOT work, using:

Max number of command threads: 15
Delivery threads: 20
Max number of asynchronous task threads: 20

Got 2 of them yesterday

Code: Select all

"ERROR"	1376	"2022-01-10 08:30:27.824"	"Severity: 3 (Medium), Code: HM5157, Source: SpamAssassinClient::OnReadError, Description: There was a communication error with SpamAssassin. hMailServer tried to retrieve data from SpamAssassin but the connection to SpamAssassin was lost. The WinSock error code is 2. Enable debug logging to retrieve more information regarding this problem. The problem could be that SpamAssassin is malfunctioning."
"ERROR"	584	"2022-01-10 08:30:27.824"	"Severity: 2 (High), Code: HM5508, Source: SpamAssassinTestConnect::TestConnect, Description: The SpamAssassin tests did not complete. Please confirm that the configuration (host name and port) is valid and that SpamAssassin is running."
"ERROR"	1428	"2022-01-10 09:45:27.235"	"Severity: 3 (Medium), Code: HM5157, Source: SpamAssassinClient::OnReadError, Description: There was a communication error with SpamAssassin. hMailServer tried to retrieve data from SpamAssassin but the connection to SpamAssassin was lost. The WinSock error code is 2. Enable debug logging to retrieve more information regarding this problem. The problem could be that SpamAssassin is malfunctioning."
"ERROR"	6672	"2022-01-10 09:45:27.250"	"Severity: 2 (High), Code: HM5508, Source: SpamAssassinTestConnect::TestConnect, Description: The SpamAssassin tests did not complete. Please confirm that the configuration (host name and port) is valid and that SpamAssassin is running."
I have days i see none of those errors, but most days i see 1 or 2 @work server instance and i believe it is related the amount of mail is being processed by the server, @home where is have a very low volume i almost see none of these errors, if your service instance processes little volume of mails obviously the error isn't likely to show up much.

FYI, in another topic about this issue there has been a report that someone was able to confirm there is some kind of boost/network error, eg: not returning all data & closing the connection prematurely that causes this error
CIDR to RegEx: d-fault.nl/cidrtoregex
DNS Lookup: d-fault.nl/dnstools
DKIM Generator: d-fault.nl/dkimgenerator
DNSBL Lookup: d-fault.nl/dnsbllookup
GEOIP Lookup: d-fault.nl/geoiplookup

User avatar
jim.bus
Senior user
Senior user
Posts: 941
Joined: 2011-05-28 11:49
Location: US

Re: Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by jim.bus » 2022-01-11 13:14

RvdH wrote:
2022-01-11 10:59
I read this in the other thread you posted this in, i can only confirm this for me this change does NOT work, using:

Max number of command threads: 15
Delivery threads: 20
Max number of asynchronous task threads: 20

Got 2 of them yesterday

I have days i see none of those errors, but most days i see 1 or 2 @work server instance and i believe it is related the amount of mail is being processed by the server, @home where is have a very low volume i almost see none of these errors, if your service instance processes little volume of mails obviously the error isn't likely to show up much.

FYI, in another topic about this issue there has been a report that someone was able to confirm there is some kind of boost/network error, eg: not returning all data & closing the connection prematurely that causes this error
I indicated I usually get a Winsock Error at least a couple of times a month though maybe sometimes only once. The point being is that I don't go, as best I recall, 3 months without a Winsock Error. This is why I waited 3 months before posting this. Based on fact I haven't received a Winsock Error in 3 months, I postulate that this is evidence of a possible solution. I also indicate that I allow for the possibility that if I have greater volume of email messages I could then start seeing the Winsock Error again for which the possible remedy may be to increase the 'Max number of asynchronous task threads again'. For now, though, it appears 20 for me appears to be working.

I, also, am not sure if the Winsock Error is related to the volume of email messages or if it is related to the number of email messages in a single connection to hMailServer while processing Anti-SPAM protection. Example a connection which has multiple recipients in the email connection. The Help Documentation isn't exactly clear what is meant by parallel connections but it is clear that the external connections are while running Anti-SPAM protection . See excerpt from Help Documentation below.


Max number of asynchronous task threads

This setting defines how many parallell connections hMailServer will make to external software while running anti-spam protection. The settings defines for example how many connections hMailServer will open up to SpamAssassin at most.


So, you have confirmed what I suspected would possibly happen with higher volume of email messages but a higher volume of email messages could also have more opportunity for more parallel connections while processing Anti-SPAM protection. In your case for your work hMailServer, you might want to try a higher 'Max number of asynchronous task threads'. But you might have to be careful to not make the number too high as hMailServer might then have a performance issue. As I indicated, I chose 20 arbitrarily hoping to not increase the number too much but I have a much smaller volume of email messages.

However, I will continue to watch my hMailServer for these Winsock Errors in case they start up again.

User avatar
katip
Senior user
Senior user
Posts: 1032
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by katip » 2022-01-11 14:06

jim.bus wrote:
2022-01-11 13:14

Max number of asynchronous task threads

This setting defines how many parallell connections hMailServer will make to external software while running anti-spam protection. The settings defines for example how many connections hMailServer will open up to SpamAssassin at most.
FWIW i played with this value after reading your previous post some days ago. 20, 30 didn't work, but finally at 48 i have no error since about 3 days, which is unseen :!: normally i was getting this error every day at least 2 times.
from tech point of view i have no idea how this value works. as i see in spamd log my SA checkings shouldn't be more than a few per minute even in workdays' peak hours (we use extensive whitelisting). so, enabling 30/40+ connections to SA makes no sense to me, but this is the result. maybe all this is a wishful thinking and i get an error in next 5 minutes :lol:
we'll see..
Katip
--
HMS 5.7, MariaDB 10.4.10, SA 3.4.4, ClamAV 0.103.5

User avatar
katip
Senior user
Senior user
Posts: 1032
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by katip » 2022-01-11 14:45

katip wrote:
2022-01-11 14:06
maybe all this is a wishful thinking and i get an error in next 5 minutes :lol:
believe it or not (14 mins) :lol:

Code: Select all

"ERROR"	5348	"2022-01-11 15:20:26.834"	"Severity: 3 (Medium), Code: HM5157, Source: SpamAssassinClient::OnReadError, Description: There was a communication error with SpamAssassin. hMailServer tried to retrieve data from SpamAssassin but the connection to SpamAssassin was lost. The WinSock error code is 2. Enable debug logging to retrieve more information regarding this problem. The problem could be that SpamAssassin is malfunctioning."
"ERROR"	4708	"2022-01-11 15:20:26.834"	"Severity: 2 (High), Code: HM5508, Source: SpamAssassinTestConnect::TestConnect, Description: The SpamAssassin tests did not complete. Please confirm that the configuration (host name and port) is valid and that SpamAssassin is running."
no, i won't try 58 :P
Katip
--
HMS 5.7, MariaDB 10.4.10, SA 3.4.4, ClamAV 0.103.5

User avatar
jim.bus
Senior user
Senior user
Posts: 941
Joined: 2011-05-28 11:49
Location: US

Re: Possible Method To Avoid Spamassasin Annoying Winsock Error

Post by jim.bus » 2022-01-11 20:47

katip wrote:
2022-01-11 14:45
katip wrote:
2022-01-11 14:06
maybe all this is a wishful thinking and i get an error in next 5 minutes :lol:
believe it or not (14 mins) :lol:

Code: Select all

"ERROR"	5348	"2022-01-11 15:20:26.834"	"Severity: 3 (Medium), Code: HM5157, Source: SpamAssassinClient::OnReadError, Description: There was a communication error with SpamAssassin. hMailServer tried to retrieve data from SpamAssassin but the connection to SpamAssassin was lost. The WinSock error code is 2. Enable debug logging to retrieve more information regarding this problem. The problem could be that SpamAssassin is malfunctioning."
"ERROR"	4708	"2022-01-11 15:20:26.834"	"Severity: 2 (High), Code: HM5508, Source: SpamAssassinTestConnect::TestConnect, Description: The SpamAssassin tests did not complete. Please confirm that the configuration (host name and port) is valid and that SpamAssassin is running."
no, i won't try 58 :P
For the past couple of months, I've thought in order to tell if this was working I probably should try dropping the value back down to 15 or maybe even lower to see if the Winsock Error returns. This wouldn't be absolute proof but it would lend more credence to my theory. I haven't done it so far because I wanted a bit more proof in the form of longevity of time since getting the Winsock Error but I may try that.

By the way I've reduced the Whitelisting I used to do especially since I don't have many email messages to contend with and the processing time I would save is minimal due to the volume of email messages.

Post Reply