DCE write() causes "Thread-unsafe invocation" in UDP client example

62 views
Skip to first unread message

Thomas Burger

unread,
Dec 18, 2014, 4:22:00 PM12/18/14
to ns-3-...@googlegroups.com
Dear all,

I'm struggling with a slightly modified dce-udp-simple.cc example.

Please have a look at attached files.

dce-udp-simple.cc
1. Added ns-3 Csma channel and assigned IP addresses in the 10.0.0.0 network, i.e. the only node gets 10.0.0.1/24. The 'csma' module has been added to the wscript.
2. Removed UDP server (not relevant to show the problem)
3. Added 10.0.0.123 as destination, i.e. a IP address which is not reachable

udp-client.cc
1. Added debug output
2. Send only a single UDP packet (sufficient to show the problem)

Problem
~/dce-ns3-1.4/source/ns-3-dce$ ./waf --run dce-udp-simple
...
assert failed. cond="SystemThread::Equals (m_main)", msg="Simulator::Schedule Thread-unsafe invocation!", file=../src/core/model/default-simulator-impl.cc, line=222

The error is the same if send() instead of write() is used in the UDP client application, but not if sendto() is used (see comments in udp-client.cc)?!
Also, the error only occurs when sending to an destination IP address within the node's subnet; if the destination IP is localhost or some IP off of the local subnet, write() succeeds or returns -1 correctly (see comments in dce-udp-simple.cc).

I've already tried to debug, but the assertion seems to be caused deep down in some ns-3 layer3 model...
For the moment, it would be nice if someone could verify this behaviour.

Thanks a lot,
Thomas


PS:
Configuration is Ubuntu 12.04 LTS 64-bit using freshly installed dce-ns3-1.4
Linux Edge13 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

dce-tcp-simple.cc
udp-client.cc

Thomas Burger

unread,
Dec 18, 2014, 4:29:19 PM12/18/14
to ns-3-...@googlegroups.com
Sorry, dce-tcp-simple.cc was the wrong attachment. Correct dce-udp-simple.cc is here.



dce-udp-simple.cc

Hajime Tazaki

unread,
Dec 20, 2014, 7:45:34 PM12/20/14
to ns-3-...@googlegroups.com

Hi Thomas,

thanks. I've filled a bugzilla entry: it seems a bug of DCE.

https://www.nsnam.org/bugzilla/show_bug.cgi?id=2035

-- Hajime

At Thu, 18 Dec 2014 13:29:19 -0800 (PST),
Thomas Burger wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (7bit)>]
> Sorry, dce-tcp-simple.cc was the wrong attachment. Correct
> dce-udp-simple.cc is here.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.
> [1.2 <text/html; UTF-8 (7bit)>]
>
> [2 dce-udp-simple.cc <text/x-c++src; US-ASCII (7bit)>]
> #include "ns3/network-module.h"
> #include "ns3/core-module.h"
> #include "ns3/internet-module.h"
> #include "ns3/dce-module.h"
> #include "ns3/csma-module.h"
>
> using namespace ns3;
>
> int main (int argc, char *argv[])
> {
> CommandLine cmd;
> cmd.Parse (argc, argv);
>
> NodeContainer nodes;
> nodes.Create (1);
>
> NetDeviceContainer devices;
>
> CsmaHelper csma;
> csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
> csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
> devices = csma.Install (nodes);
>
> InternetStackHelper stack;
> stack.Install (nodes);
>
> Ipv4AddressHelper address;
> address.SetBase ("10.0.0.0", "255.255.255.0");
> Ipv4InterfaceContainer interfaces = address.Assign (devices);
>
> DceManagerHelper dceManager;
> dceManager.Install (nodes);
>
> DceApplicationHelper dce;
> ApplicationContainer apps;
>
> dce.SetStackSize (1 << 20);
>
> //Ignore UDP server
> //dce.SetBinary ("udp-server");
> //dce.ResetArguments ();
> //apps = dce.Install (nodes.Get (0));
> //apps.Start (Seconds (4.0));
>
> dce.SetBinary ("udp-client");
> dce.ResetArguments ();
> //dce.AddArgument ("127.0.0.1"); // works with write()
> //dce.AddArgument ("1.2.3.4"); // works with write(), -1 and EHOSTUNREACH
> dce.AddArgument ("10.0.0.123");// crashes with write() and send(), works with sendto()
> apps = dce.Install (nodes.Get (0));
> apps.Start (Seconds (4.5));
>
> Simulator::Stop (Seconds (1000100.0));
> Simulator::Run ();
> Simulator::Destroy ();
>
> return 0;
> }
Reply all
Reply to author
Forward
0 new messages