socket() not working under DCE

99 views
Skip to first unread message

Hans van den Bogert

unread,
Sep 4, 2014, 5:21:29 AM9/4/14
to ns-3-...@googlegroups.com
I have the following test script:

#include <iostream>
#include <sys/socket.h>

main(){
std::cout << "testing" << std::endl;

int sfd = socket(AF_INET, SOCK_DGRAM, 0);
close(sfd);
}

However this leads to a SIGSEGV
Command ['/home/vagrant/src/dce/source/ns-3-dce/build/myscripts/processingandsleep/bin/dce-processingandsleep'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>”).

(ignore the misleading ‘processingandsleep’ name)


I’m not sure where I’m messing up, I’ve done:
1) The usual -fPIC and -pie and -rdynamic during compile and linking (albeit with CMake using cmake . -DCMAKE_CXX_FLAGS=“-pie -fPIC”, though also tried “manually” with g++ invocations)
2) Tested it on fresh VM with ubuntu 12.04
3) Tested it on my main dev machine 14.04
4) Tested it on Hajime’s docker image.

If i change the socket() line with a more trivial sleep() function, it behaves as it should under DCE.

Regards,

Hans

Hajime Tazaki

unread,
Sep 4, 2014, 8:46:42 AM9/4/14
to ns-3-...@googlegroups.com

Hi,

I couldn't reproduce your issue on my laptop: FC19-64bits,
with the dce-linux-dev.

Q1) is there any other message 'before' the SIGSEGV alert ?
Q2) how was the complete command line of the compile/link ?
Q3) how was the ns3 script that your program runs ? maybe
dce-processingandsleep.cc is what I want to see.

-- Hajime

At Thu, 4 Sep 2014 11:24:40 +0200,
> --
> 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.

Hans van den Bogert

unread,
Sep 5, 2014, 8:05:48 AM9/5/14
to ns-3-...@googlegroups.com
Hi Hajime,

I was struggling with a lot of things, almost all of them boil down to using a wrong example script as a base script for my testing :(
In this case I hadn't equipped a node with an internet stack, stupid me..

I understand that NS-3 won't check for these things, such as null-references for performance reasons, but wouldn't it be nice to have a debug build of NS-3/DCE which would check for these things?

Hajime Tazaki

unread,
Sep 12, 2014, 12:42:55 AM9/12/14
to ns-3-...@googlegroups.com

At Fri, 5 Sep 2014 05:05:48 -0700 (PDT),
Hans van den Bogert wrote:
>
> [1 <text/plain; UTF-8 (7bit)>]
> Hi Hajime,
>
> I was struggling with a lot of things, almost all of them boil down to
> using a wrong example script as a base script for my testing :(
> In this case I hadn't equipped a node with an internet stack, stupid me..
>
> I understand that NS-3 won't check for these things, such as
> null-references for performance reasons, but wouldn't it be nice to have a
> debug build of NS-3/DCE which would check for these things?

okay, that's fairly reasonable feedback. I will add such a
check with ns3 stack. do you have anything else that want to
be checked ?

-- Hajime

Hans van den Bogert

unread,
Sep 12, 2014, 12:57:45 AM9/12/14
to ns-3-...@googlegroups.com

Not sure ATM. But I guess that every access to objects of nodes which could result in null references and thus segmentation errors could be checked in debug mode.

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/2Y5FzSph7Lk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

Hajime Tazaki

unread,
Nov 6, 2014, 8:34:07 AM11/6/14
to ns-3-...@googlegroups.com

Hi,

I quickly added the error checks that you suggested.

http://code.nsnam.org/ns-3-dce/rev/579cac731917

thanks and sorry for the late update.

-- Hajime

At Fri, 12 Sep 2014 06:57:23 +0200,
> 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.
> [2 <text/html; UTF-8 (quoted-printable)>]
>

Hans van den Bogert

unread,
Nov 6, 2014, 8:41:01 AM11/6/14
to ns-3-...@googlegroups.com
Just happy to see it was picked up eventually :)

Regards,
Reply all
Reply to author
Forward
0 new messages