Discussion:
Net::Server sockets are not opened, why ?
Wladimir Mutel
2018-11-13 20:40:17 UTC
Permalink
Dear all,

I am using amavisd-new 2.11.0 as shipped with Ubuntu 18.04, with added
configuration changes from https://www.iredmail.org/
After recent reboot of my system, I noticed that postfix
3.3.0-1ubuntu0.1 is unable to contact queue filter at localhost:10024 ,
and lsof -n does not show any process listening on this port. I set
$log_level = 4; in /etc/amavis/conf.d/50-user and I see this in the log
(after amavis service restart):

лис 13 22:13:41 smart amavis[10833]: Net::Server: Accept failed with 28
tries left: Invalid argument
...
лис 13 22:14:08 smart amavis[10833]: Net::Server: Accept failed with 1
tries left: Invalid argument
лис 13 22:14:09 smart amavis[10833]: Net::Server: Accept failed with 0
tries left: Invalid argument
лис 13 22:14:10 smart amavis[10833]: Net::Server: Ran out of accept retries!

Overall it looks like sockets are created but not put into 'listen'ing
state, so 'accept' calls on them fail.
I tried to follow the logic of socket initialization in amavisd-new and
Net/Server.pm sources but I could not reach any definite conclusion so
far. I suspect there could be some accidental changes in combination of
bind address and listen socket numbers but I am not sure I got to the
proper places in Net/Server* sources.

So I would ask someone competent who encountered this behavior, how
should I fix that ?

iRedMail sets $inet_socket_port = [10024, 10026, 9998]; in
/etc/amavis/conf.d/50-user
I have ipv4 & ipv6 (6to4) enabled on my server which could impact bind
address selection.
@listen_sockets array is clearly non-empty
And then, Amavis->new is constructed, as a derived class from
Net::Server, and passes it 'port'=>\@listen_sockets and
'host'=>$bind_to[0] parameters, and after that I could not trace it any
deeper. I see this in the logs :

лис 13 17:03:08 smart amavis[5825]: will bind to
/var/lib/amavis/amavisd.sock|unix, 127.0.0.1:10024/tcp,
127.0.0.1:10026/tcp, 127.0.0.1:9998/tcp
лис 13 17:03:08 smart amavis[5834]: sd_notify (no socket):
MAINPID=5834\nSTATUS=Daemonized, preparing to bind sockets.
лис 13 17:03:08 smart amavis[5834]: Net::Server: Binding to UNIX socket
file "/var/lib/amavis/amavisd.sock"
лис 13 17:03:08 smart amavis[5834]: Net::Server: Binding to TCP port
10024 on host 127.0.0.1 with IPv4
лис 13 17:03:08 smart amavis[5834]: Net::Server: Binding to TCP port
10026 on host 127.0.0.1 with IPv4
лис 13 17:03:08 smart amavis[5834]: Net::Server: Binding to TCP port
9998 on host 127.0.0.1 with IPv4

But how can I be sure that 'listen' return code is properly checked in
Perl sources ? and that 'listen' call is not bypassed due to some
accidental condition ?

Thank you in advance for your responses. I can provide you 'sudo'
access on my host and the right to change any related configs and to
restart any needed services or the whole system.

Continue reading on narkive:
Loading...