On startup spamd dies with "IO::Socket::INET: Invalid argument"
This bug is seen from time to time and is currently tracked down via the Gentoo Bug 58122. The reason why it happens is yet unknown, but it seems to be caused by a broken Perl.
When you start spamd with debugging you will see something like this:
The output above is from SpamAssassin 3.0.0, previous versions are a bit less verbose.
The FAQ on the amavisd-new site notes:
On some operating systems the Perl module IO::Socket reports obscure error on unsuccessful connect() in non-blocking mode as: "Invalid argument" in place of the true cause: "Connection refused".
The remote service should be checked if available and accessible (firewall rules? network problems?).
Another possible reason for "Invalid argument" reported by IO::Socket when running within chroot jail is some network-related system file missing in a chroot jail, e.g. /etc/protocols, /etc/services, /etc/netconfig, /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts, /etc/host.conf – depending on the operating system in use.
System debugging tools (debugger, strace, truss) may help to find the cause.
The Gentoo bug mentioned above lead to the following wrong bind(2) call:
That one should actually look like:
Both the contents of the second parameter,
struct sockaddr *my_addr, and the value of the third,
socklen_t addrlen, are completely bogus. In hex they read:
Note the number 783, which is the port we try to connect on (as a string). The characters 1 and 6 might be the Type and Proto values above. Conclusion: Brain... err... Memfart
An upgrade to Perl 5.8.4 helped in the case mentioned. Recompiling Perl might have helped, too.