[Ns-developers] About real-world application integration

Hajime Tazaki tazaki at sfc.wide.ad.jp
Mon Mar 16 09:45:19 PDT 2009


At Mon, 16 Mar 2009 12:49:19 +0100,
Mathieu Lacage wrote:
>
>On Mon, 2009-03-16 at 19:40 +0900, Hajime Tazaki wrote:
>
>> >> > {
>> >> >   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;
>> >> >       DeleteProcess (process);
>> >> >+      i = m_processes.erase (i);
>> >> >     }
>> >> >-  m_processes.clear ();
>> >> 
>> >> I can make a patch, too.
>> >
>> >I meant that I don't really understand what this patch is doing: it
>> >seems that it's really doing the same thing as before, only differently.
>> 
>> Ah, sorry.
>> 
>> When DeleteProcess is called, and threads is not empty,
>> DeleteProcess hook SIGKILL in the context of DoDispose(),
>> and delivered to simu_exit(). Then process is removed from
>> m_processes before returning DeleteProcess().
>> 
>> So if there is multiple processes in m_processes, it might
>> be problem. This patch try to fix this.
>
>I am really very sorry but I don't understand the problem this patch is
>solving. Could you try to outline for me the exact scenario which is
>problematic with the previous version ?

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.



But.....


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

What do you think?

regards,
hajime




More information about the Ns-developers mailing list