[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Platform quirks - darwin
From: |
Jan-Henrik Haukeland |
Subject: |
Re: Platform quirks - darwin |
Date: |
Thu, 04 Sep 2003 01:53:47 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Common Lisp, linux) |
Rick Robino <address@hidden> writes:
> Since this is platform testing week and Christian brought up quirks
> I thought I'd return to the malloc error that the mac build brings
> up when checking (remote) status. It can be coerced away and other
> platforms won't be bothered by it, but I'm still not sure that there
> is a real bug that this fixes - you be the judge:
>
> The error:
> time ./monit status
> The monit daemon uptime: 13m
> *** malloc[3831]: Deallocation of a pointer not malloced: 0x19ea98;
*
> The backtrace:
> (gdb) n
The problem with a malloc bug is that the debugger will report this
wrong (because malloc throws (normally) SIGSEGV on the *next* call to
malloc *after* the bug). To really pinpont the location of the bug you
need to use tools like efence which keeps track on allocated memory.
Please download efence from: ftp://ftp.perens.com/pub/ElectricFence/
and put the following in your $HOME/.gdbinit
------8<-----------------------------------------------------------------------
define efence
set environment EF_PROTECT_BELOW 0
set environment LD_PRELOAD /usr/lib/libefence.so
echo Enabled Electric Fence\n
end
document efence
Enable memory allocation debugging through Electric Fence (efence(3)).
See also nofence and underfence.
end
define underfence
set environment EF_PROTECT_BELOW 1
set environment LD_PRELOAD /usr/lib/libefence.so
echo Enabled Electric Fence for undeflow detection\n
end
document underfence
Enable memory allocation debugging for underflows through Electric Fence
(efence(3)).
See also nofence and underfence.
end
define nofence
unset environment LD_PRELOAD
echo Disabled Electric Fence\n
end
document nofence
Disable memory allocation debugging through Electric Fence (efence(3)).
end
------8<-----------------------------------------------------------------------
Then run gdb on monit from XEmacs and start Electric Fence from gdb by
typing `efence'. Here is a trace from my gdb/efence session and as you
can see I cannot reproduce this error, but this is on Linux. In your
case, when the bug occurs efence will stop gdb exactly in (or at least
in the neighborhood) of the statement which lead to the malloc bug.
Current directory is /home/hauk/utv/release/monit_release/monit/
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) efence
Enabled Electric Fence
(gdb) r status
Starting program: /home/hauk/utv/release/monit_release/monit/monit status
[New Thread 1024 (LWP 5208)]
Electric Fence 2.2.0 Copyright (C) 1987-1999 Bruce Perens <address@hidden>
The monit daemon uptime: 6h 19m
Device 'disk1' is accessible
Space: 26.4% [6502.3 MB] Inodes: 8.3% [266128 objects]
UID: 0 GID: 0 Permission: 755
Monitoring status: monitored
Device 'cdrom' is accessible
Space: 100.0% [186.3 MB]
UID: 501 GID: 6 Permission: 600
Monitoring status: monitored
Process 'sybase' is running with pid [2324]
Uptime: 6h 19m CPU: 0.0% Memory w/o children: 0.2% [2340kB]
Children: 1 Memory w/ children: 0.4% [3896kB]
Monitoring status: monitored
Process 'apache' is running with pid [3859]
Uptime: 4h 10m CPU: 0.0% Memory w/o children: 0.0% [0kB]
Children: 0 Memory w/ children: 0.0% [0kB]
Monitoring status: not monitored
File 'httpd.bin' exist
Size: 21B UID: 501 GID: 501 Permission: 664
Monitoring status: monitored
File 'httpd.conf' exist
Size: 36156B UID: 501 GID: 501 Permission: 644
Monitoring status: monitored
Host 'rhn.redhat.com'
Port 80 is not available
Monitoring status: not monitored
Host 'ftp.redhat.com'
Port 21 is not available
Monitoring status: not monitored
Program exited normally.
(gdb)
--
Jan-Henrik Haukeland