Pavlin Radoslavov wrote:
Ben Greear <[EMAIL PROTECTED]> wrote:
Pavlin Radoslavov wrote:
Ben Greear <[EMAIL PROTECTED]> wrote:
I'm getting a repeatable crash in xorpsh (I have not yet added that patch
that Pavlin sent yesterday...this is just the latest cvs).
Is there a simple procedure how to repeat the crash?
I don't think so...seems it might be a race of some kind...
I'm trying to add a new file to libxorp/ dir to help debug
this. I tried editing the Makefile.am and reran ./configure in the
base dir, but the .cc file is still not being compiled. What do I
need to do to make it compile my file?
If you modify any Makefile.am or configure.in file, you must run
./bootstrap
in the XORP top-level directory.
After that you need to run ./configure
Note however that you should have installed the same versions of the
autotools we are using, otherwise the result is unpredictable:
autoconf: 2.61
automake: 1.10
libtool: 1.5.22
Also, see the beginning of the "bootstrap" script for the list of
environmental variables you might need to set if the installed
executables on your machine doesn't match those names:
ACLOCAL=${ACLOCAL:-"aclocal-1.10"}
AUTOCONF=${AUTOCONF:-"autoconf-2.61"}
AUTOHEADER=${AUTOHEADER:-"autoheader-2.61"}
AUTOM4TE=${AUTOM4TE:-"autom4te-2.61"}
AUTOMAKE=${AUTOMAKE:-"automake-1.10"}
LIBTOOLIZE=${LIBTOOLIZE:-"libtoolize"}
That sounds a bit scary...it won't be easy to fix this if
my versions are off. I managed to manually tweak the Makefile
for now...
Anyway, I added my 'bug-cather' files and sure enough, we are deleting
already-freed memory:
(gdb) bt
#0 0x08189566 in TimerNode::release_ref (this=0x83016d0) at timer.cc:87
#1 0x080bea0e in ~XorpTimer (this=0xbf8cdf04) at timer.hh:537
#2 0x0818a24c in TimerList::expire_one (this=0xbf8d4014, worst_priority=9) at
timer.cc:458
#3 0x0818a395 in TimerList::run (this=0xbf8d4014) at timer.cc:428
#4 0x08170688 in EventLoop::run (this=0xbf8d4010) at eventloop.cc:114
#5 0x080c1cdf in XorpShell::run (this=0xbf8d20d0, [EMAIL PROTECTED]) at
xorpsh_main.cc:388
#6 0x080c3b69 in main (argc=1, argv=0xbf8d4304) at xorpsh_main.cc:897
(gdb) frame 0
#0 0x08189566 in TimerNode::release_ref (this=0x83016d0) at timer.cc:87
87 in timer.cc
(gdb) print *this
$1 = {<HeapBase> = {<BugCatcher> = {_vptr.BugCatcher = 0x0, magic = 3735928559,
static _cnt = 8},
_pos_in_heap = -1}, _ref_cnt = -1, _expires = {static ONE_MILLION =
1000000, _sec = 179108,
_usec = 477834}, _cb = {_M_ptr = 0x0, _M_index = 71}, _priority = 9, _list
= 0xbf8d4014}
(gdb) print /x this->magic
$2 = 0xdeadbeef
(gdb)
No fix yet, but please consider the attached patch and new files..this has saved
me many hours debugging complex applications & core files...
Thanks,
Ben
Regards,
Pavlin
--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc http://www.candelatech.com
? bgp/bgp.cc.flc
? cli/cli_node_net.cc.ben
? cli/cli_node_net.cc.flc
? fea/data_plane/control_socket/click_socket.cc.flc
? fea/data_plane/io/io_ip_socket.cc.ben
? fea/data_plane/io/io_ip_socket.cc.flc
? fea/data_plane/io/io_tcpudp_socket.cc.flc
? libxorp/Makefile.flc
? libxorp/bug_catcher.cc
? libxorp/bug_catcher.hh
? xrl/interfaces/fea_ifmgr_mirror_xif.cc.flc
? xrl/targets/fea_base.cc.flc
? xrl/targets/fea_base.hh.flc
? xrl/targets/fea_ifmgr_mirror_base.cc.flc
Index: cli/cli_client.hh
===================================================================
RCS file: /cvs/xorp/cli/cli_client.hh,v
retrieving revision 1.34
diff -u -r1.34 cli_client.hh
--- cli/cli_client.hh 3 Oct 2007 23:14:13 -0000 1.34
+++ cli/cli_client.hh 12 Oct 2007 01:51:22 -0000
@@ -49,7 +49,7 @@
*
* There is one CLI client per CLI user (e.g., telnet connection).
*/
-class CliClient {
+class CliClient : public BugCatcher {
public:
/**
* Constructor for a given CLI node and file descriptor.
RCS file: /cvs/xorp/libxorp/Makefile.am,v
retrieving revision 1.53
diff -u -r1.53 Makefile.am
--- libxorp/Makefile.am 22 Apr 2007 01:57:09 -0000 1.53
+++ libxorp/Makefile.am 12 Oct 2007 01:51:28 -0000
@@ -112,6 +112,7 @@
libxorp_la_SOURCES += utility.h
libxorp_la_SOURCES += win_io.h
+libxorp_la_SOURCES += bug_catcher.hh
libxorp_la_SOURCES += asnum.hh
libxorp_la_SOURCES += asyncio.hh
libxorp_la_SOURCES += buffer.hh
@@ -172,6 +173,7 @@
libxorp_la_SOURCES += win_io.c
libxorp_la_SOURCES += xlog.c
+libxorp_la_SOURCES += bug_catcher.cc
libxorp_la_SOURCES += asyncio.cc
libxorp_la_SOURCES += buffered_asyncio.cc
libxorp_la_SOURCES += c_format.cc
Index: libxorp/clock.hh
===================================================================
RCS file: /cvs/xorp/libxorp/clock.hh,v
retrieving revision 1.5
diff -u -r1.5 clock.hh
--- libxorp/clock.hh 16 Feb 2007 22:46:18 -0000 1.5
+++ libxorp/clock.hh 12 Oct 2007 01:51:29 -0000
@@ -18,11 +18,13 @@
#ifndef __LIBXORP_CLOCK_HH__
#define __LIBXORP_CLOCK_HH__
+#include "bug_catcher.hh"
+
class TimeVal;
-class ClockBase {
+class ClockBase : public BugCatcher {
public:
- virtual ~ClockBase() = 0;
+ virtual ~ClockBase();
/**
* Update internal concept of time.
Index: libxorp/heap.hh
===================================================================
RCS file: /cvs/xorp/libxorp/heap.hh,v
retrieving revision 1.14
diff -u -r1.14 heap.hh
--- libxorp/heap.hh 16 Feb 2007 22:46:19 -0000 1.14
+++ libxorp/heap.hh 12 Oct 2007 01:51:29 -0000
@@ -33,6 +33,7 @@
#endif
#include "timeval.hh"
+#include "bug_catcher.hh"
/**
* @short Heap class
@@ -50,10 +51,11 @@
* Objects stored on the heap should inherit from this class. If
* removal from arbitary positions (not just head) is required.
*/
-class HeapBase {
+class HeapBase : public BugCatcher {
public:
HeapBase() : _pos_in_heap(NOT_IN_HEAP)
{}
+ virtual ~HeapBase() { }
int _pos_in_heap; // position of this object in the heap
};
Index: libxorp/timer.hh
===================================================================
RCS file: /cvs/xorp/libxorp/timer.hh,v
retrieving revision 1.35
diff -u -r1.35 timer.hh
--- libxorp/timer.hh 23 May 2007 12:12:44 -0000 1.35
+++ libxorp/timer.hh 12 Oct 2007 01:51:29 -0000
@@ -28,6 +28,8 @@
#include "heap.hh"
#include "callback.hh"
#include "task.hh"
+#include "bug_catcher.hh"
+
class XorpTimer;
class TimerNode;
@@ -207,14 +209,14 @@
* because no XorpTimer references the underlying element on the TimerList
* after <code>TimerList::new_oneoff_after_ms()</code> is called.
*/
-class TimerList {
+class TimerList : public BugCatcher {
public:
/**
* @param clock clock object to use to query time.
*/
TimerList(ClockBase* clock);
- ~TimerList();
+ virtual ~TimerList();
/**
* Expire all pending @ref XorpTimer objects associated with @ref
#include "bug_catcher.hh"
unsigned int BugCatcher::_cnt = 0;
#ifndef __LF_BUG_CATCHER_INC__
#define __LF_BUG_CATCHER_INC__
#include <assert.h>
class BugCatcher {
private:
unsigned int magic;
static unsigned int _cnt;
public:
BugCatcher() { magic = 0x1234543; _cnt++; }
BugCatcher(const BugCatcher& rhs) { magic = rhs.magic; _cnt++; }
virtual ~BugCatcher() { assertNotDeleted(); magic = 0xdeadbeef; _cnt--; }
virtual void assertNotDeleted() const {
assert(magic != 0xdeadbeef);
}
static int getInstanceCount() { return _cnt; }
};
#endif
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers