Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zabbix agent crashes trying to load module libzbxpgsql.so on AIX #158

Open
roumio opened this issue May 7, 2020 · 7 comments
Open

Zabbix agent crashes trying to load module libzbxpgsql.so on AIX #158

roumio opened this issue May 7, 2020 · 7 comments

Comments

@roumio
Copy link

roumio commented May 7, 2020

Hello,

I am trying to use this module on AIX 7200-03-03-1914 with zabbix agent version 4.0.18.

Have successfully compiled the module using the following options and two different compilers, XLC and GCC:
export OBJECT_MODE=64
CC=/opt/IBM/xlc/13.1.0/bin/xlc CFLAGS=-q64 ./configure --with-postgresql=/opt/postgres/11.5/bin/pg_config --with-zabbix=/apps/zabbix-4.0.18
CC=/usr/bin/gcc CFLAGS=-maix64 ./configure --with-postgresql=/opt/postgres/11.5/bin/pg_config --with-zabbix=/apps/zabbix-4.0.18

In order for compile to succeed, I had to make two minor changes in code:
#diff libzbxpgsql.c libzbxpgsql.c.orig
27c27
< #include <sys/socket.h>

191c191
< if (NULL == (handle = dlopen(NULL, RTLD_LAZY)))

if (NULL == (handle = dlopen(NULL, RTLD_LAZY | RTLD_NOLOAD)))

Otherwise compilers complained that macros RTLD_NOLOAD, AF_INET and AF_INET6 were undeclared.
Since I could not locate macro RTLD_NOLOAD in any header (.h) file on the whole system, I simply removed it from libzbxpgsql.c :)

After enabling libzbxpgsql.so module loading in configuration file of zabbix agent, agent crashes when trying to start it with the following message:

22479114:20200504:161804.520 Starting Zabbix Agent [HOSTNAME]. Zabbix 4.0.18 (revision 688cd21456).
22479114:20200504:161804.520 **** Enabled features ****
22479114:20200504:161804.520 IPv6 support: NO
22479114:20200504:161804.520 TLS support: NO
22479114:20200504:161804.520 **************************
22479114:20200504:161804.520 using configuration file: /etc/zabbix/zabbix_agentd.conf
22479114:20200504:161804.521 Got signal [signal:4(SIGILL),reason:30,refaddr:0]. Crashing ...
22479114:20200504:161804.521 ====== Fatal information: ======
22479114:20200504:161804.522 program counter not available for this architecture
22479114:20200504:161804.522 === Registers: ===
22479114:20200504:161804.522 register dump not available for this architecture
22479114:20200504:161804.522 backtrace is not available for this platform
22479114:20200504:161804.522 === Memory map: ===
22479114:20200504:161804.522 memory map not available for this platform
22479114:20200504:161804.522 ================================

When loading of libzbxpgsql.so module is disabled in configuration file of zabbix agent, agent starts and works without any problems.

I am confused.
Any ideas?

@i-ky
Copy link
Contributor

i-ky commented May 7, 2020

Since you are compiling yourself, you can try module version prior to #141. I guess this will solve the problem for you.

But to solve the problem for everyone, could you please provide man dlopen from your system? Also could you increase DebugLevel and get a more verbose log of crashing?

Did you compile Zabbix yourself? Can you rebuild it with LDFLAGS=-bexpall?

I think this is the issue we are running into.

@roumio
Copy link
Author

roumio commented May 8, 2020

Here is the man page for dlopen:
https://www.ibm.com/support/knowledgecenter/ssw_aix_72/d_bostechref/dlopen.html

Increasing DebugLevel to maximum does not produce much more information:

31457700:20200508:114443.675 Starting Zabbix Agent [HOSTNAME]. Zabbix 4.0.18 (revision 688cd21456).
31457700:20200508:114443.675 **** Enabled features ****
31457700:20200508:114443.675 IPv6 support: NO
31457700:20200508:114443.675 TLS support: NO
31457700:20200508:114443.675 **************************
31457700:20200508:114443.675 using configuration file: /etc/zabbix/zabbix_agentd.conf
31457700:20200508:114443.675 In zbx_load_modules()
31457700:20200508:114443.676 loading module "/apps/zabbix/modules/libzbxpgsql.so"
31457700:20200508:114443.676 Got signal [signal:4(SIGILL),reason:30,refaddr:0]. Crashing ...
31457700:20200508:114443.676 ====== Fatal information: ======
31457700:20200508:114443.676 program counter not available for this architecture
31457700:20200508:114443.676 === Registers: ===
31457700:20200508:114443.676 register dump not available for this architecture
31457700:20200508:114443.676 backtrace is not available for this platform
31457700:20200508:114443.676 === Memory map: ===
31457700:20200508:114443.676 memory map not available for this platform
31457700:20200508:114443.676 ================================

I have compiled the zabbix agent myself.
Have also tried zabbix agent version 4.0.7 precompiled by Zabbix company with the same result: agent works normally without libzbxpgsql.so module loaded and crashes when loading is tried with the same error message.
I can rebuild zabbix agent with "LDFLAGS=-bexpall" if it still makes sense.

Thank you!

@roumio roumio closed this as completed May 8, 2020
@roumio roumio reopened this May 8, 2020
@roumio
Copy link
Author

roumio commented May 8, 2020

Didn't mean to close the issue, but the "Comment" button was greyed out :)

@i-ky
Copy link
Contributor

i-ky commented May 8, 2020

Yes, rebuilding Zabbix agent with -bexpall still makes sense. Could you please try it?

@roumio
Copy link
Author

roumio commented Jun 5, 2020

Yes, rebuilding Zabbix agent with -bexpall still makes sense. Could you please try it?

I have recompiled both the zabbix agent and the libzbxpgsql with LDFLAGS=-bexpall.

Error when trying to start the agent is still the same:

Starting Zabbix Agent [HOSTNAME]. Zabbix 4.0.21 (revision 17a78afe45).
**** Enabled features ****
IPv6 support: NO
TLS support: NO


using configuration file: /etc/zabbix/zabbix_agentd.conf
In zbx_load_modules()
loading module "/apps/zabbix/modules/libzbxpgsql.so"
Got signal [signal:4(SIGILL),reason:30,refaddr:0]. Crashing ...
====== Fatal information: ======
program counter not available for this architecture
=== Registers: ===
register dump not available for this architecture
backtrace is not available for this platform
=== Memory map: ===
memory map not available for this platform

@i-ky
Copy link
Contributor

i-ky commented Jun 18, 2020

@roumio, to be honest, I'm a bit lost. I have no experience with AIX. Do you know if a mere mortal like me can get a VirtualBox image or something like that to experiment with?

@i-ky
Copy link
Contributor

i-ky commented Jun 20, 2020

@roumio, do you use other modules as well? Do they work as they should?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants