[ZBX-3395] socket() for [[-]:10050] failed with error 22: Invalid argument Created: 2011 Jan 08  Updated: 2017 May 30  Resolved: 2011 Jan 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 1.8.4
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Anton Dollmaier Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian Lenny 5.0.7 / Squeeze
Kernel 2.6.26-2-xen-amd64
ipv6-enabled host


Attachments: Text File zabbix.txt    

 Description   

Zabbix agentd quits with following log message:

===
24383:20110108:215150.563 Zabbix Agent started. Zabbix 1.8.4 (revision 16604).
24383:20110108:215150.564 Listener failed with error: socket() for [[-]:10050] failed with error 22: Invalid argument.
===

see forum for detailled information

http://www.zabbix.com/forum/showthread.php?p=78303#post78303



 Comments   
Comment by Anton Dollmaier [ 2011 Jan 10 ]

Additional information:

Building with "--disable-ipv6 --enable-agent" changes nothing, same errors.

Comment by Alexander Vladishev [ 2011 Jan 11 ]

This error arises at attempt to run Zabbix agent compiled on version 2.6.27 or above on a platform with a kernel 2.6.26 and lower.

Comment by Aleksandrs Saveljevs [ 2011 Jan 11 ]

Note that static linking will not help in this case because it is the socket() system call that does not support SOCK_CLOEXEC flag on earlier kernels.

Comment by Anton Dollmaier [ 2011 Jan 11 ]

Solved, indeed.

Just bootet the squeeze-VM with 2.6.32-5, agent now works as expected:

===
512:20110111:132326.619 Zabbix Agent started. Zabbix 1.8.4 (revision 16604).
520:20110111:132326.630 zabbix_agentd listener started
519:20110111:132326.631 zabbix_agentd listener started
518:20110111:132326.631 zabbix_agentd listener started
517:20110111:132326.631 zabbix_agentd collector started
===

Thanks for checking into this!

Comment by Steve Allison [ 2011 Jan 29 ]

Can this ticket be reopened?

I'm having the same issue (same log lines) on a genuine ipv6 enabled machine, having compiled Zabbix 1.8.4 stable on a 2.6.26 kernel running debian squeeze.

Is it just simply that Zabbix 1.8.4 now REQUIRES 2.6.27+ kernel?

Comment by Steve Allison [ 2011 Jan 29 ]

Just FYI: I have been through the same troubleshooting steps. a) enabled/disabled ipv6 at configure time b) with ipv4/ipv6 for IP, or blank

Comment by Anton Dollmaier [ 2011 Jan 29 ]

The problem is not ZABBIX, it's Debian Squeeze:

You HAVE to run Squeeze with 2.6.32!

Even compiling on Squeeze does not solve this issue, I assume that libc6 is compiled against 2.6.32 and therefor also ZABBIX agent requries 2.6.27+.

If you also have a squeeze-VM running on a lenny XEN Dom0: install linux-image-2.6.32-xen-amd64 in the VM, copy /boot/vmlinuz-2.6.32*, /boot/initrd-2.6.32* and /lib/modules/2.6.32* to the Dom0, change your domU's config to use the new kernel on the dom0 and restart the VM.

This works - resulting in Debian squeeze with 2.6.32 kernel, zabbix works.

Comment by Anton Dollmaier [ 2011 Jan 29 ]

The problem is not ZABBIX, it's Debian Squeeze:

You HAVE to run Squeeze with 2.6.32!

Even compiling on Squeeze does not solve this issue, I assume that libc6 is compiled against 2.6.32 and therefor also ZABBIX agent requries 2.6.27+.

If you also have a squeeze-VM running on a lenny XEN Dom0: install linux-image-2.6.32-xen-amd64 in the VM, copy /boot/vmlinuz-2.6.32*, /boot/initrd-2.6.32* and /lib/modules/2.6.32* to the Dom0, change your domU's config to use the new kernel on the dom0 and restart the VM.

This works - resulting in Debian squeeze with 2.6.32 kernel, zabbix works.

Comment by Marcel Jäpel [ 2011 Feb 06 ]

It's not always possible to use Debian Squeeze with kernel > 2.6.26.

Many hosting providers use Virtuozzo/OpenVZ. The most of them use a kernel like 2.6.18, 2.6.24 or 2.6.26.
This will not change in the near future.

Other applications are working in this environment. So I think, something must be done.

Comment by Anton Dollmaier [ 2011 Feb 06 ]

I maintain an host in a virtuozzo container with 2.6.18-028stab070.14 and Debian Squeeze - the zabbix agent works flawlessly, although I didn't expect that to happen. The reported bug does not show up here.

Comment by Marcel Jäpel [ 2011 Feb 06 ]

I have some systems with OpenVZ and Debian Lenny (2.6.26)/Ubuntu Hardy(2.6.24) on my site. The Debian Squeeze containers have the same problem that is described here.

Comment by richlv [ 2011 Feb 07 ]

marcel, have you tried compiling the agent on a platform with kernel 2.6.26 or lower (maybe the same you plan to run it on) ?
if the problem description is correct, that should solve your issue

Comment by Paul D. Walker [ 2011 Feb 07 ]

same problem,

compiled on a newer kernal, ran on a 2.6.26 kernel.

problem resolved once I compiled on the 2.6.26 kernel.

time to upgrade my kernels

Comment by Marcel Jäpel [ 2011 Feb 07 ]

I compiled it in a OpenVZ container on a Debian Lenny host (2.6.26 x86_64) and Debian Squeeze (x86_64) inside the container.
libc: 2.11.2-10
gcc: 4.4.5-1
kernel: 2.6.26-2-openvz-amd64

Problem still exists.

Comment by AG [ 2012 Jan 31 ]

I compiled Zabbix 1.8.10 in a xen domU with Debian Squeeze amd64 and

libc: 2.11.3-2
gcc: 4.4.5-8
kernel: 2.6.26-2-xen-amd64

and the agentd fails to start in the exact same machine with the same socket error as above.
So the statement "This error arises at attempt to run Zabbix agent compiled on version 2.6.27 or above on a platform with a kernel 2.6.26 and lower." also written in the FAQ cannot be true...

The Zabbix 1.8.2 from the Debian Squeeze repositories run without problems though...

Comment by Christoph Haas [ 2012 May 31 ]

Why is this report set to "wont' fix"? The problem apparently still exists for Zabbix agents of version 1.8.11 at least.
On several machines I randomly get:
27271:20120531:110804.261 Starting Zabbix Agent [svn]. Zabbix 1.8.11 (revision 26205).
27271:20120531:110804.261 listener failed: socket() for [[0.0.0.0]:10050] failed: [22] Invalid argument

This is a very annoying issue and I can't figure out how to solve it other than install an ancient 1.8.2 agent on those systems.

Comment by Christoph Haas [ 2012 May 31 ]

I believe I found something. This problem happened on Debian GNU/Linux systems where I installed security updates. Apparently it involves kernel updates. A reboot fixes the problem. So perhaps some networking APIs are using parts of the wrong kernel.

Comment by gescheit [ 2012 Sep 07 ]

You can build zabbix with -DOLD_LIBC_MODE

diff -ur zabbix-2.0.2_orig/src/libs/zbxcomms/comms.c zabbix-2.0.2/src/libs/zbxcomms/comms.c
— zabbix-2.0.2_orig/src/libs/zbxcomms/comms.c 2012-07-31 13:16:46.000000000 +0400
+++ zabbix-2.0.2/src/libs/zbxcomms/comms.c 2012-08-30 18:56:36.525523544 +0400
@@ -31,8 +31,12 @@

  1. define ZBX_SOCKLEN_T socklen_t
    #endif

-#if !defined(SOCK_CLOEXEC)

    1. define SOCK_CLOEXEC 0 /* SOCK_CLOEXEC is Linux-specific, available since 2.6.23 */
      +#if !defined(OLD_LIBC_MODE)
      +# if !defined(SOCK_CLOEXEC)
      +# define SOCK_CLOEXEC 0 /* SOCK_CLOEXEC is Linux-specific, available since 2.6.23 */
      +# endif
      +#else
      +# define SOCK_CLOEXEC 0
      #endif

/******************************************************************************

Comment by Vyacheslav Kuznetsov [ 2012 Dec 22 ]

Just applied gescheit's patch. Now Zabbix-server 2.0.4 runs on Linux kernel 2.6.21.

Generated at Wed Jul 02 08:19:39 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.