netxmsd dies when trying to setup and delete users and groups

Started by Dan, October 14, 2009, 07:19:05 PM

Previous topic - Next topic

Dan

Hi,
Im running 0.2.30 under ubuntu intrepid.
Netxms where running fine during configuration until I tried to configure new users and groups, like adding new access, removing access, adding users to groups, as well as deleting some of them.
This happens when running it both as a daemon and in the foreground,

netxmsd  -c /etc/netxms/netxmsd.conf
Using configuration file "/etc/netxms/netxmsd.conf"
Configuration file OK
[14-Oct-2009 17:06:05] Platform subagent "/usr/lib/libnsm_linux.so" successfully loaded
[14-Oct-2009 17:06:05] Database driver "/usr/local/lib/libnxddr_pgsql.so" loaded and initialized successfully
[14-Oct-2009 17:06:05] Stalled database lock removed
[14-Oct-2009 17:06:05] Listening for SNMP traps on UDP socket 0.0.0.0:162
[14-Oct-2009 17:06:05] Listening for client connections on TCP socket 0.0.0.0:4701
[14-Oct-2009 17:06:05] NetXMS Server started

NetXMS Server V0.2.30 Ready
Enter "help" for command list or "down" for server shutdown
System Console

netxmsd: Segmentation fault

When I restart netxms and connect again, the deleted and altered groups/users are still there.

I am able to add nodes and change other things without any hazard.

I am running it with PostgreSQL 8.3.8

I have attached an strace of a crash.

Anyone got an idea what could be wrong?

Dan

Checked the eventlog and noticed the following entry when trying to remove one of the groups:

"Database query failed [Query: DELETE FROM groups WHERE id =-2147483643; Error: ERROR: relation "groups" does not exist]

Which is correct as there is no such table.

It seems like that error causes netxmsd to crash.

Located in src/server/core/userdb_objects.cpp on row 651,
_sntprintf(query, 256, _T("DELETE FROM groups WHERE id=%d"), m_id);

Victor Kirhenshtein

Hi!

Yes, it's a bug - there should be

DELETE FROM user_groups WHERE id=%d

However, failed SQL query should not cause server to crash anyway. Could you try to replace groups to user_groups in this query, recompile server and try delete group again?

Best regards,
Victor

Victor Kirhenshtein

Just tested on my Ubuntu machine with PostgreSQL - I got failed SQL query, but no crash. Could you please run netxmsd under gdb and when it crashes get stack trace with bt command?

To run under gdb:

# gdb netxmsd
(gdb) run

when crashes
(gdb) bt

Best regards,
Victor

Dan

Will do,

I have recompiled the server though and it seems like I am able to remove groups without any problem.
But I will run it in gdb and send a trace.

Best regards,
Dan

Dan

Here it is, this time when I created a few groups,

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x42807950 (LWP 29468)]
0x00007f91007b0055 in free () from /lib/libc.so.6
(gdb) bt
#0  0x00007f91007b0055 in free () from /lib/libc.so.6
#1  0x00007f91020ff143 in ~Group (this=0x186c000) at userdb_objects.cpp:561
#2  0x00007f91020fd64a in SaveUsers (hdb=0x7f90f001b510) at userdb.cpp:136
#3  0x00007f91020f897d in Syncer (arg=<value optimized out>) at syncer.cpp:116
#4  0x00007f9101e5c3ea in start_thread () from /lib/libpthread.so.0
#5  0x00007f910081acbd in clone () from /lib/libc.so.6
#6  0x0000000000000000 in ?? ()
(gdb)


Best regards,
Dan

Victor Kirhenshtein

I was able to reproduce this problem on my machine. Please replace file src/server/core/userdb_objects.cpp and recompile server - problem should be fixed.

Best regards,
Victor

Dan

Ah nice.
Thanks for the very fast help and answers!

Best regards,
Dan