Re: [Nagios-db-devel] Segfaults with the postgres ned
Status: Beta
Brought to you by:
bench23
|
From: Tim V. <dj...@ro...> - 2005-01-20 16:26:45
|
On Wed, 19 Jan 2005, Ben wrote:
...snip...
>> I'm using :
>>
>> gcc -g -O2 -o inserter.o inserter.c -shared -I /usr/include/nagios
>> -I/usr/include/pgsql -lpq
>
> That should be fine. Just to be sure what's actually getting used, would you
> run an ldd on inserter.o and see what the linker will add at runtime?
This is the output from ldd, looks fine to me :
libpq.so.3 => /usr/lib/libpq.so.3 (0x009b8000)
libc.so.6 => /lib/tls/libc.so.6 (0x00111000)
libssl.so.4 => /lib/libssl.so.4 (0x0027b000)
libcrypto.so.4 => /lib/libcrypto.so.4 (0x003cf000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x0032a000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x0024a000)
libresolv.so.2 => /lib/libresolv.so.2 (0x00e9d000)
libnsl.so.1 => /lib/libnsl.so.1 (0x002b0000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00314000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x007e1000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x005d9000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00f5c000)
libdl.so.2 => /lib/libdl.so.2 (0x0068a000)
libz.so.1 => /usr/lib/libz.so.1 (0x004c1000)
>> I've then started from a empty database. When I then start nagios I get
>> this error :
...snip...
> That really shouldn't fail. Try turning on debug logging on your postgres
> server and see what it says about things.
Enabling some extensive logging helped. I've found a couple of issues in
the stored procedures. One in host.sql is already fixed in CVS. This is
the other :
diff -u -r1.3 restart.sql
--- restart.sql 16 Jan 2005 20:21:43 -0000 1.3
+++ restart.sql 20 Jan 2005 16:23:32 -0000
@@ -28,7 +28,7 @@
thisHostID int;
BEGIN
-- get the host id. If this is a new host, insert the host and
get the id
- select into thisHostID id FROM host WHERE name = thisHostName;
+ select into thisHostID id FROM host WHERE name = hostName;
if thisHostID is not null
then
>> Finaly I get a segfault at the PQclear function for the processStatus call
>> for the host data.
...snip...
> It's possible that maybe the result which PQclear is trying to clear is null.
> I cannot recall at the moment if PQclear(0) will result in badness.
The error is always at the same place the PQclear in processStatus. I've
did a run with gdb and the segfault occurs in :
Program received signal SIGSEGV, Segmentation fault.
0x0039d50d in malloc_consolidate () from /lib/tls/libc.so.6
That seems a strange place for a segfault to happen, so I'm a bit lost
what to make of it.
Kind regards,
Tim
--
Tim Verhoeven - dj...@ro... - 0479 / 88 11 83
/* This is total bullshit: */
linux-2.6.6/drivers/video/sis/init301.c
|