[Ns-developers] About real-world application integration

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Tue Mar 17 08:49:22 PDT 2009


On Tue, 2009-03-17 at 01:45 +0900, Hajime Tazaki wrote:

> Let me show you gdb stack of this problem. This stack was
> reproduced by previous version.
> 
> #12 0xb7b4c630 in ns3::ProcessManager::DeleteProcess (this=0x80add28, process=0x87d5e10)
> #13 0xb7b4cab7 in ns3::ProcessManager::GarbageCollectDeadProcessesAndThreads (this=0x80add28)
> #14 0xb7b4f0ff in ns3::ProcessManager::Schedule (this=0x80add28)
> #15 0xb7b4fa52 in ns3::ProcessManager::ScheduleFromInterrupt (this=0x80add28, thread=0x87d8ab8)
> #16 0xb7b77e98 in ns3::UtilsSendSignal (process=0x87d8520, signum=9)
> #17 0xb7b4c564 in ns3::ProcessManager::DeleteProcess (this=0x80add28, process=0x87d8520)
> #18 0xb7b4fc14 in ns3::ProcessManager::DoDispose (this=0x80add28)
> #19 0xb77d28ed in ns3::Object::Dispose (this=0x80839f8) 
> #20 0xb7936757 in ~NodeListPriv (this=0x80839b8) 
> #21 0xb77d2187 in ns3::Object::MaybeDelete (this=0x80839b8) 
> #22 0x0805f102 in ns3::Object::Unref (this=0x80839b8) 
> #23 0xb7938f0e in ns3::Ptr<ns3::NodeListPriv>::operator= (this=0xb7f195a0, o=@0xbfd3a040) 
> #24 0xb793818c in ns3::NodeListPriv::Delete () 
> #25 0xb7885592 in Notify (this=0x8083888) 
> #26 0xb786038a in ns3::EventImpl::Invoke (this=0x8083888) 
> #27 0xb788d3f7 in ns3::RealtimeSimulatorImpl::Destroy (this=0x8083a38)
> 
> When the destroy event of simulator is happened,
> DeleteProcess is called twice for each process.
> 
> and DeleteProcess in GarbageCollectDeadProcessesAndThreads()
> remove process entry from m_processes even though it was
> called from DoDispose().
> 
> So after one loop in DoDispose(), contents of m_processes
> would be changed. In that case, single process in a node
> made no problem.
> 
> 
> OTOH, when we install multiple processes into single node, as
> 
>   ApplicationContainer apps = process.Install (node);
>   ApplicationContainer apps2 = process2.Install (node);
> 
> #this is a typical case when we use zebra
> m_processes becomes to have a 2 entry in vector.
> 

ok.

> 
> But.....
> 
> 
> I become to think that this modification doesn't solve
> fundamentals. Should it avoid call DeleteProcee() twice?
> 
> What do you think?

How about moving the call to erase just after the assignment to the
local variable 'process' and before the call to DeleteProcess ?
Something like this:

> {
>   NS_LOG_FUNCTION (this);
>   GarbageCollectDeadProcessesAndThreads ();
>-  for (std::vector<struct Process *>::iterator i = m_processes.begin
>(); i != m_processes.end (); ++i)
>+  for (std::vector<struct Process *>::iterator i = m_processes.begin
>(); i != m_processes.end ();)
>     {
>       struct Process *process = *i;
>+      i = m_processes.erase (i);
>       DeleteProcess (process);
>     }
>-  m_processes.clear ();


Mathieu



More information about the Ns-developers mailing list