Due to some unrelated to this issue problems (probably system overload or slow database connection establishment or something) Zabbix server on startup starts threads significantly slower then it has to.
When there are hundreds of threads to start, the process might take 20-30 seconds. Which isn't a problem itself at all.
The problem: if takes more then 10 seconds to start threads between the first "alerter" thread has been started and the alert manager thread, which happens quite later, then the alerter thread times out with 111 error, exiting and causing Zabbix server to stop.
I propose the solution: start alert manager threads first. Which i assume might be accomplished by changing server.c code, in
function responsible for the order of threads being started.
And move lines
I did so on my test environment, the problem with alert processes has gone, and i have found no other issues with it.