I am trying to simulate a clustering algorithm. It is working fine
till the number of nodes were <= 100. But for nodes > 100 i am getting
segmentation fault. I tried changing the number of nodes in
"valuePropogation" sample application. For this also its giving
segmentation fault.
Let me know if any body else has also faced the same problem and have
some solution for that.
Thanks
Prashant
Valgrind ( http://valgrind.org/ ).
Follow the instructions to install it. It would be better if Castalia and OMNeT
were compliled with the -g flag so you get more debugging output
(source code line numbers of errors)
Valgrind is very easy to use, you do not need to rebuild your program (Castalia
in our case) to work with Valgrind. You simply pass the program as an argument
to Valgrind. If you want to debug program "myprog arg1 arg2" you type:
valgrind --leak-check=yes myprog arg1 arg2
To run Castalia we use a run script (e.g., runValProp) that does several tasks.
I am not sure if valgrind will work with this script as a parameter.
If it does not just use the plain castalia executable.
So from the appropriate simulation directory you can type:
valgrind --leak-check=yes ../../CastaliaBin
Thanassis
Indicatively these are the execution times for different network sizes for
the value prop application. (grid deployment 20 meters inter-node distance)
Note that the machine I tested this on was pretty slow, you can get much better
times.
100nodes 3secs
400nodes 16secs
900nodes 57secs
1600nodes 147secs
I would assume that you have done some modifications in Castalia that
affect parts beyond the application, but I have no information to look further.
My initial suggestion to use Valgrind could help you.
Thanassis
Thanks for the detailed reply. Actually i downloaded the fresh copy of
Castalia and then tried running connectivitymap application. Still i
am getting segmentation fault if i set number of nodes over 100.
I tried using valgrind for my application with nodes set to 102.
Following are the error messages i got. I am not sure what
information is useful for me in debugging. I will be thankful if you
can help me in this.
==26728==
==26728== Invalid read of size 4
==26728== at 0x409383D: cObject::fullPath() const (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x4089E01: cModule::callInitialize() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x401E991: TOmnetApp::startRun() (in /home/prashant/
omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x40353E9: TCmdenvApp::run() (in /home/prashant/
omnetpp-3.3/lib/libcmdenv.so.3.3)
==26728== by 0x401E1D8: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==26728==
==26728== Process terminating with default action of signal 11
(SIGSEGV)
==26728== Access not within mapped region at address 0x0
==26728== at 0x409383D: cObject::fullPath() const (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x4089E01: cModule::callInitialize() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x401E991: TOmnetApp::startRun() (in /home/prashant/
omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x40353E9: TCmdenvApp::run() (in /home/prashant/
omnetpp-3.3/lib/libcmdenv.so.3.3)
==26728== by 0x401E1D8: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728==
==26728== ERROR SUMMARY: 59 errors from 13 contexts (suppressed: 0
from 0)
==26728==
==26728== 1 errors in context 1 of 13:
==26728== Invalid read of size 4
==26728== at 0x409383D: cObject::fullPath() const (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x408AA9E: cModule::callInitialize(int) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x4089E01: cModule::callInitialize() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x401E991: TOmnetApp::startRun() (in /home/prashant/
omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x40353E9: TCmdenvApp::run() (in /home/prashant/
omnetpp-3.3/lib/libcmdenv.so.3.3)
==26728== by 0x401E1D8: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==26728==
==26728== 1 errors in context 2 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561C65: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855AA85: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 1 errors in context 3 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561B23: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855AA85: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 1 errors in context 4 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561B1B: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855AA85: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 1 errors in context 5 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561B23: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855A8DE: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 1 errors in context 6 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561B1B: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855A8DE: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 2 errors in context 7 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48562430: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855A8DE: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 5 errors in context 8 of 13:
==26728== Use of uninitialised value of size 4
==26728== at 0x40B6F31: cEnum::insert(int, char const*) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x80549E6: __MAC_ContorlMessageType_code() (in /home/
prashant/Castalia/bin/CastaliaBin)
==26728== by 0x40BB798: ExecuteOnStartup::executeAll() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x40189B7: cEnvir::setup(int, char**) (in /home/
prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x401E1CC: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728==
==26728== 5 errors in context 9 of 13:
==26728== Use of uninitialised value of size 4
==26728== at 0x40B6F20: cEnum::insert(int, char const*) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x80549E6: __MAC_ContorlMessageType_code() (in /home/
prashant/Castalia/bin/CastaliaBin)
==26728== by 0x40BB798: ExecuteOnStartup::executeAll() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x40189B7: cEnvir::setup(int, char**) (in /home/
prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x401E1CC: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728==
==26728== 5 errors in context 10 of 13:
==26728== Use of uninitialised value of size 4
==26728== at 0x40B6F14: cEnum::insert(int, char const*) (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x80549E6: __MAC_ContorlMessageType_code() (in /home/
prashant/Castalia/bin/CastaliaBin)
==26728== by 0x40BB798: ExecuteOnStartup::executeAll() (in /home/
prashant/omnetpp-3.3/lib/libsim_std.so.3.3)
==26728== by 0x40189B7: cEnvir::setup(int, char**) (in /home/
prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x401E1CC: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728==
==26728== 7 errors in context 11 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561F5B: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855A8DE: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 12 errors in context 12 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x48561C65: _dl_relocate_object (in /lib/ld-2.6.so)
==26728== by 0x4855A8DE: dl_main (in /lib/ld-2.6.so)
==26728== by 0x4856ADCA: _dl_sysdep_start (in /lib/ld-2.6.so)
==26728== by 0x485582B7: _dl_start (in /lib/ld-2.6.so)
==26728== by 0x48557816: (within /lib/ld-2.6.so)
==26728==
==26728== 17 errors in context 13 of 13:
==26728== Conditional jump or move depends on uninitialised value(s)
==26728== at 0x4033F3F: TCmdenvApp::sputn(char const*, int) (in /
home/prashant/omnetpp-3.3/lib/libcmdenv.so.3.3)
==26728== by 0x40196C4: basic_evbuf<char, std::char_traits<char>
>::sync() (in /home/prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x4019694: basic_evbuf<char, std::char_traits<char>
>::xsputn(char const*, int) (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728== by 0x4018360: cEnvir::printf(char const*, ...) (in /home/
prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x402171A: TOmnetApp::setup() (in /home/prashant/
omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x4034553: TCmdenvApp::setup() (in /home/prashant/
omnetpp-3.3/lib/libcmdenv.so.3.3)
==26728== by 0x4018BD0: cEnvir::setup(int, char**) (in /home/
prashant/omnetpp-3.3/lib/libenvir.so.3.3)
==26728== by 0x401E1CC: main (in /home/prashant/omnetpp-3.3/lib/
libenvir.so.3.3)
==26728== IN SUMMARY: 59 errors from 13 contexts (suppressed: 0 from
0)
==26728==
==26728== malloc/free: in use at exit: 2,432,496 bytes in 41,556
blocks.
==26728== malloc/free: 91,027 allocs, 49,471 frees, 6,347,920 bytes
allocated.
==26728==
==26728== searching for pointers to 41,556 not-freed blocks.
==26728== checked 2,111,760 bytes.
==26728==
==26728== LEAK SUMMARY:
==26728== definitely lost: 0 bytes in 0 blocks.
==26728== possibly lost: 38,943 bytes in 1,232 blocks.
==26728== still reachable: 2,393,553 bytes in 40,324 blocks.
==26728== suppressed: 0 bytes in 0 blocks.
==26728== Rerun with --leak-check=full to see details of leaked
memory.
--26728-- memcheck: sanity checks: 758 cheap, 31 expensive
--26728-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--26728-- memcheck: auxmaps: 0 searches, 0 comparisons
--26728-- memcheck: SMs: n_issued = 200 (3200k, 3M)
--26728-- memcheck: SMs: n_deissued = 1 (16k, 0M)
--26728-- memcheck: SMs: max_noaccess = 65535 (1048560k, 1023M)
--26728-- memcheck: SMs: max_undefined = 0 (0k, 0M)
--26728-- memcheck: SMs: max_defined = 81 (1296k, 1M)
--26728-- memcheck: SMs: max_non_DSM = 199 (3184k, 3M)
--26728-- memcheck: max sec V bit nodes: 0 (0k, 0M)
--26728-- memcheck: set_sec_vbits8 calls: 0 (new: 0, updates: 0)
--26728-- memcheck: max shadow mem size: 3488k, 3M
--26728-- translate: fast SP updates identified: 18,584
( 86.4%)
--26728-- translate: generic_known SP updates identified: 1,893
( 8.8%)
--26728-- translate: generic_unknown SP updates identified: 1,030
( 4.7%)
--26728-- tt/tc: 114,451 tt lookups requiring 135,911 probes
--26728-- tt/tc: 114,451 fast-cache updates, 3 flushes
--26728-- transtab: new 11,940 (284,836 -> 4,596,671; ratio
161:10) [0 scs]
--26728-- transtab: dumped 0 (0 -> ??)
--26728-- transtab: discarded 8 (187 -> ??)
--26728-- scheduler: 75,845,099 jumps (bb entries).
--26728-- scheduler: 758/247,527 major/minor sched events.
--26728-- sanity: 759 cheap, 31 expensive checks.
--26728-- exectx: 30,011 lists, 1,306 contexts (avg 0 per list)
--26728-- exectx: 140,557 searches, 139,303 full compares (991 per
1000)
--26728-- exectx: 0 cmp2, 151 cmp4, 0 cmpAll
Segmentation fault
Thanks,
Prashant
a) open for editing Castalia/config/Castalia.config
b) uncomment the following line:
# CFLAGS+= -g
(remove the "#" that is located at the front of the line)
c) save the changes you made and change to the home directory of
Castalia
d) make clean
e) ./makemake
f) make
Wait for a while because compilation with -g flag is always slower.
After that, Valgrind will give you back information about sourcecode
lines.
A nice short tutorial on the usage of Valgrind is found at:
http://www.cprogramming.com/debugging/valgrind.html
HOWEVER, I believe that it is not something wrong with the source code
of Castalia because
Thanassis and I have tested the simulator with more nodes (>1000) and
nothing is wrong.
Please provide us with a tarball of your *.ini files and with the
output of valgrind.
Try not to post this huge amount of information here but send it at:
castalia AT nicta.com.au
Cheers,
Dimos.
> ==26728== checked 2,111,760 bytes. ...
>
> read more ยป
In most application modules (in template app too) there is
the following code in the initialize function.
char buff[30];
sprintf(buff, "Application Vector of Node %d", self);
appVector.setName(buff);
When node id becomes 3 digits then this causes buffer overwrites
in some systems (depending on libc and compiler they are using)
An easy way to fix it (patch it) is to just make the buff a little bigger
say 33 bytes.
In the future dist of castalia we will get rid of sprintf statements altogether.