Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 58122 - spamd fails to create a socket with "IO::Socket::INET: Invalid argument"
Summary: spamd fails to create a socket with "IO::Socket::INET: Invalid argument"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 All
: High normal (vote)
Assignee: Gentoo Perl team
URL: http://wiki.apache.org/spamassassin/I...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-23 14:28 UTC by André Lemos
Modified: 2004-12-20 04:51 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
perl -V (log,2.66 KB, text/plain)
2004-07-25 11:26 UTC, André Lemos
Details
(Test) patch against spamd (spamd.pat,833 bytes, patch)
2004-07-25 16:17 UTC, Malte S. Stretz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description André Lemos 2004-07-23 14:28:58 UTC
I'm starting to have this problem, when I try to start spamassassin (/etc/init.d/spamd start), I get:

Could not create INET socket: Invalid argument IO::Socket::INET: Invalid argument

The version of spamassassin is 2.63
Comment 1 Malte S. Stretz 2004-07-24 10:49:29 UTC
Please post the output of the following five commands:
  cat /etc/conf.d/spamd
  spamd -D
  emerge -pv spamassassin
  perl -V
  id
Comment 2 André Lemos 2004-07-25 11:25:21 UTC
<b>cat /etc/conf.d/spamd</b>
SPAMD_OPTS="-a"

<b>spamd -D</b>
debug: Score set 0 chosen.
Could not create INET socket: Invalid argument IO::Socket::INET: Invalid argument

<b>emerge -pv spamassassin</b>
[ebuild   R   ] mail-filter/spamassassin-2.63  +berkdb +ssl  0 kB

<b>id</b>
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video),250(portage)


(let's hope the b tags stick up) ;)
Comment 3 André Lemos 2004-07-25 11:26:53 UTC
Created attachment 36138 [details]
perl -V
Comment 4 Malte S. Stretz 2004-07-25 16:17:13 UTC
Created attachment 36150 [details, diff]
(Test) patch against spamd

That looks like a local configuration problem. From
<http://ftp.cfu.net/pub/amavisd-new/>:
| 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. 

Please do the following:

1. What does the following command say? Should be 1.27.
     perl -MIO::Socket -le 'print $IO::Socket::INET::VERSION'


2. Please apply the attached patch with the following command (replace
"spamd.patch" with the name under which you saved the attachment):
      patch /usr/bin/spamd spamd.patch
You should get the following:
creating INET socket:
	Listen: 128
	LocalAddr: 127.0.0.1
	LocalPort: 783
	Proto: 6
	ReuseAddr: 1
	Type: 1
If you've got different values, something's wrong with your system but I can
hopefully find out what it is ;)
Comment 5 André Lemos 2004-07-25 17:47:41 UTC
yes it is 1.27, and the patch gives me:

debug: Score set 0 chosen.
creating INET socket:
        Listen: 128
        LocalAddr: 127.0.0.1
        LocalPort: 783
        Proto: 6
        ReuseAddr: 1
        Type: 1
Could not create INET socket: Invalid argument IO::Socket::INET: Invalid argument
Comment 6 Malte S. Stretz 2004-07-25 23:50:22 UTC
Hm, the last few days I learned more about the IO::Socket internals than I ever wanted ;-)

This looks like some Perl bug, nothing really SpamAssassin related. Either the call socket(AF_INET, SOCK_STREAM, 6) or sockopt(SO_REUSEPORT, 1) fails with an EINVAL. Which shouldn't happen.

Just out of interested, could you please attach the output of 'strace spamd' so I know which command exactly fails?

As a workaround, you could try to use spamd with UNIX sockets (which is also a little bit faster than TCP). See --socketpath in the spamd manpage and -U for spamc. Maybe re-emerging perl would help, too, but I doubt it.
Comment 7 André Lemos 2004-07-26 01:05:40 UTC
read(5, "# /etc/protocols:\n# $Id: protoco"..., 4096) = 1846
close(5)                                = 0
munmap(0x40018000, 4096)                = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffff78c) = -1 EINVAL (Invalid argument)
_llseek(5, 0, 0xbffff7c0, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffff78c) = -1 EINVAL (Invalid argument)
_llseek(5, 0, 0xbffff7c0, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(5, {sa_family=0x3837 /* AF_??? */, sa_data="3\0\0\0\0\0\0\0\0\0001\306\1\0"}, 3) = -1 EINVAL (Invalid argument)
close(5)                                = 0
write(2, "Could not create INET socket: In"..., 82Could not create INET socket: Invalid argument IO::Socket::INET: Invalid argument
Comment 8 Malte S. Stretz 2004-07-26 03:59:24 UTC
bind(5, {sa_family=0x3837 /* AF_??? */, sa_data="3\0\0\0\0\0\0\0\0\0001\306\1\0"}, 3) = -1 EINVAL (Invalid argument)

This looks fishy and is the culprit. sa_family should be AF_INET, which is 2. And addrlen (the third parameter) should be 16 instead of 3.

That command is called in the deep guts of Perl itself, your 'perl -V' output looks good, I don't know why your Perl is so b0rked.
Comment 9 André Lemos 2004-07-30 08:07:20 UTC
updating perl to the latest table on the stable tree did the trick (5.8.4)
Comment 10 Malte S. Stretz 2004-07-30 08:20:25 UTC
Great. Thanks for helping debugging this stuff.
Comment 11 Marc "Slyoldfox" Vanbrabant 2004-12-20 04:51:32 UTC
I seem to be getting this also now after emerging dev-lang/perl-5.8.5-r2, has any of your done an upgrade to this version yet with spamassassin?