[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Re: bug fix in scheduler.{h,cc}



Hi Sashi,
      Thanks for solving the problem. I'll put out the fix from the
bug-fix page.
Thanks,
--Padma Haldar

On Tue, 19 Jun 2001, Shashi Guruprasad wrote:


> Problem Description:
> ====================
>
> Trying to change the scheduler to anything other than the default Calender
> scheduler (using Tcl Simulation class's use-scheduler method) causes a seg
> fault in wireless scenarii.
>
> The static Scheduler::instance_ field never gets reinitialized back to
> NULL when the Scheduler class's destructor is called.
>
> Solution:
> =========
>
> Scheduler being a base class needs a virtual destructor with 1 line
> reinitializing the field to NULL.
>
> The diffs with the cvs version of the files is included in this email to
> be incorporated by the NS team@ISI
>
> Notes:
> ======
>
> This fix enables wireless scenarii to be used in NS emulation.
>
> --scheduler.h diff with CVS version 1.20 in the NSNAM cvs tree--
> 101d100
> <       virtual ~Scheduler();
> >
> --end scheduler.h diff --
>
> --scheduler.cc diff with CVS version 1.62 in the NSNAM cvs tree--
> 64,68d63
> < Scheduler::~Scheduler()
> < {
> <     instance_ = NULL ;
> < }
> <
> --end scheduler.cc diff --
>
>
> ---------- Forwarded message ----------
> Date: Fri, 15 Jun 2001 11:58:47 -0600 (MDT)
> From: Shashi Guruprasad <[email protected]>
> To: Padmaparna Haldar <[email protected]>
> Subject: NS wireless examples segfault on changing the scheduler (looks
>     like some memory overwrite)
>
> Hi,
>
> I was informed that you have done a lot of porting and hacking of the NS
> wireless code. I'm trying to get wireless scenarii to work under emulation
> (in allinone 2.1b7a). As a first step, I just tried changing the scheduler
> from the default calender to realtime. However, I get a seg fault when
> creating a new wireless node. A gdb "where" tells me that the offending
> line is 93 in scheduler.cc in the function Scheduler::schedule(...) which
> is a virtual function call to the function insert(). The _vptr$ appears to
> be corrupted coz its NULL when it should be pointing to the VTBL of class
> RealTimeScheduler. The problem occurs for any scheduler (Heap, List) other
> than Calendar. I did try putting a watchpoint on the _vptr$'s location but
> the watchpoint was never triggered and I'm essentially lost. I built NS
> with dmalloc and enabled the highest level of debugging possible
> (including ones that are supposed to out of bounds writes). However, I
> couldn't solve the problem.
>
> It also appears that 2.1b8 doesn't solve this seg fault although I could't
> compile it due to tclsh version mismatch.
>
> Could you please take a quick look at the problem? You'll probably be able
> to narrow down the problem a lot quicker. My work's been blocked for the
> past 2 days.
>
> Thanks in advance,
> Shashi
>
>
>
>

-- 
------------------------------------------------
Be true to your work, your word, and your friend.
--Thoreau

Padmaparna Haldar