[Click] segmentation fault in nsclick

Robert Sombrutzki sombrutz at informatik.hu-berlin.de
Sat Oct 18 05:24:14 EDT 2008


Hi everyone,
i've a Segmentation Fault using nsclick. i just use a simple click script and 
start a simulation with 3 nodes, but the ns2 crashs. this seems to be related 
to the git-commit with the ID 87b5fea5093045459ac6a899d386c61200850560
( Comment:Greatly reduce parsing and initialization time on large configs. 
Date: 2008-10-17).
If i remove this patch, evereything works fine again. I also recompile the ns2 
(version 2.30) since some headers of click changed, which are maybe important 
for ns2, but i got the same result. just to remove the mention patch helps.
Any idea ? Has the click-skripts to be changes, since this modifications on 
click ?
I also append the output of gdb. Maybe some of you has an idea.

Best,
Robert


Here are my click-script ( very simpl. it does nothing) :

##  test.click
elementclass Bar {
    input[0]
    -> [0]output;    
}

Idle()
-> Bar
-> Discard();

Now the tcl-script:
##test.tcl

Propagation/Shadowing set pathlossExp_ 2.0  ;# path loss exponent
Propagation/Shadowing set std_db_ 4.0       ;# shadowing deviation (dB)
Propagation/Shadowing set dist0_ 1.0        ;# reference distance (m)
Propagation/Shadowing set seed_ 0           ;# seed for RNG

Mac/802_11 set dataRate_ 11Mb
Mac/802_11 set basicRate_ 1Mb 
Mac/802_11 set RTSThreshold_ 3000

Phy/WirelessPhy set Pt_ 0.281838

Phy/WirelessPhy set freq_ 2.472e9 

Phy/WirelessPhy set RXThresh_ 3.28984e-09

Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

set xsize  400
set ysize  400
set wtopo	[new Topography]
$wtopo load_flatgrid $xsize $ysize

set netchan	Channel/WirelessChannel
set netphy	Phy/WirelessPhy
set netmac	Mac/802_11
set netprop     Propagation/Shadowing
set antenna     Antenna/OmniAntenna

set netifq	Queue/ClickQueue
set netll	LL/Ext
LL set delay_			1ms

set node_dist   80
set nodecount   3
set stoptime    16.0

Agent/Null set sport_		5000
Agent/Null set dport_		5000

Agent/CBR set sport_		5000
Agent/CBR set dport_		5000

Simulator set MacTrace_ ON
set ns_		[new Simulator]

set tracefd     [open "test.tr" w]
set namtrace    [open "test.nam" w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $xsize $ysize
$ns_ use-newtrace

set god_ [create-god $nodecount]

Simulator set node_factory_ Node/MobileNode/ClickNode

set chan_1_ [new $netchan]
set prop_ [new $netprop]

set iptemplate "10.9.0.%d"
set mactemplate "00:03:47:70:89:%0x"
for {set i 0} {$i < $nodecount} {incr i} {
    set node_ip($i) [format $iptemplate [expr $i+2]]
    set node_mac($i) [format $mactemplate [expr $i]]
}

$ns_ rtproto Empty

for {set i 0} {$i < $nodecount } {incr i} {
    set node_($i) [$ns_ node]

    $node_($i) add-interface $chan_1_ $prop_ $netll $netmac \
	  $netifq 1 $netphy $antenna $wtopo

    $node_($i) setmac "eth0" $node_mac($i)

    $node_($i) random-motion 0
    $node_($i) topography $wtopo
    $node_($i) nodetrace $tracefd

    [$node_($i) set classifier_] setnodename "node$i"
}
for {set i 0} {$i < ( $nodecount - 1 ) } {incr i} {
[$node_($i) entry] loadclick "test.click"
}

for {set i 0} {$i < $nodecount} {incr i} {
   $ns_ at 0.0 "[$node_($i) entry] runclick"
}

set startxmittime 0
set xmitrate 4
set xmitinterval 0.25
set packetsize 64


for {set i 0} {$i < $nodecount} {incr i} {
    $node_($i) set X_ [expr $i % 2 * $node_dist ]
    $node_($i) set Y_ [expr $i / 2 * $node_dist ]
    $node_($i) set Z_ 0
    $node_($i) label $node_mac($i).brn
}

for {set i 0} {$i < $nodecount} {incr i} {
    $ns_ initial_node_pos $node_($i) 20
}

$ns_ at  $stoptime.000000001 "puts \"NS EXITING...\" ; $ns_ halt"

$ns_ at  $stoptime	"$ns_ nam-end-wireless $stoptime"

puts "Starting Simulation..."
$ns_ run


Now the GDB-output:
ombrutz at nfs-student2:~/brnnew_test$ 
gdb /home/sombrutz/develop/simulation/ns-2.30.new/bin/ns 
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...Using host libthread_db 
library "/lib/tls/libthread_db.so.1".

(gdb) set args test.tcl
(gdb) run
Starting program: /home/sombrutz/develop/simulation/ns-2.30.new/bin/ns 
test.tcl
num_nodes is set 3
INITIALIZE THE LIST xListHead

Program received signal SIGSEGV, Segmentation fault.
0x40149d37 in Click::Lexer::find_tunnel (this=0x86a4cc0, h=@0xbffaaf10, 
isoutput=false, insert=true) at lexer.cc:1718
1718        if (h.idx < _tunnels[m]->_port.idx)
Current language:  auto; currently c++
(gdb) bt
#0  0x40149d37 in Click::Lexer::find_tunnel (this=0x86a4cc0, h=@0xbffaaf10, 
isoutput=false, insert=true) at lexer.cc:1718
#1  0x4014c753 in Click::Lexer::add_tunnel (this=0x86a4cc0, 
namein=@0xbffab064, nameout=@0xbffab04c) at lexer.cc:986
#2  0x4014d04d in Click::Lexer::Compound::expand_into (this=0x86b34b0, 
lexer=0x86a4cc0, which=1, ve=@0xbffab164) at lexer.cc:376
#3  0x4014dfd5 in Click::Lexer::expand_compound_element (this=0x86a4cc0, 
which=1, ve=@0x86b3dc8) at lexer.cc:1620
#4  0x4014e1d4 in Click::Lexer::create_router (this=0x86a4cc0, 
master=0x86b89c0) at lexer.cc:1636
#5  0x40171590 in Click::click_read_router (filename=@0xbffab384, 
is_expr=false, errh=0x868a968, initialize=false, master=0x0) at driver.cc:507
#6  0x403269e8 in simclick_click_create (simnode=0x8669920, 
router_file=0x863f638 "test.click") at nsclick.cc:103
#7  0x08068937 in ClickClassifier::command ()
#8  0x0827aeb8 in TclClass::dispatch_cmd ()
#9  0x0827eba0 in OTclDispatch (cd=<value optimized out>, in=0x846d228, 
argc=4, argv=0xbffab59c) at otcl.c:434
#10 0x08283337 in TclInvokeStringCommand ()
#11 0x08284bc3 in TclEvalObjvInternal ()
#12 0x082ab4af in TclExecuteByteCode ()
#13 0x082b191c in TclCompEvalObj ()
#14 0x082ab5a9 in TclExecuteByteCode ()
#15 0x082b191c in TclCompEvalObj ()
#16 0x082d8b69 in TclObjInterpProc ()
#17 0x082d8f32 in TclProcInterpProc ()
#18 0x0827ece9 in OTclDispatch (cd=<value optimized out>, in=0x846d228, 
argc=3, argv=0xbffac14c) at otcl.c:477
#19 0x08283337 in TclInvokeStringCommand ()
#20 0x08284bc3 in TclEvalObjvInternal ()
#21 0x082ab4af in TclExecuteByteCode ()
#22 0x082b191c in TclCompEvalObj ()
#23 0x08286fb2 in Tcl_EvalObjEx ()
#24 0x0828bf25 in Tcl_ForObjCmd ()
#25 0x08284bc3 in TclEvalObjvInternal ()
#26 0x08286356 in Tcl_EvalEx ()
#27 0x082c8c13 in Tcl_FSEvalFile ()
#28 0x082cbdf4 in Tcl_Main ()
#29 0x0804d7b7 in main ()
(gdb)


More information about the click mailing list