openthread / ot-ns

OpenThread Network Simulator, a discrete event simulator and visualization tool for Thread networks.
https://openthread.io
BSD 3-Clause "New" or "Revised" License
57 stars 23 forks source link

OTNS fails to add router on WSL #510

Closed ga-resideo closed 1 year ago

ga-resideo commented 1 year ago

OTNS fails at multiple levels on WSL, not just adding a router, but for the sake of troubleshooting what's happening I'm focusing on why adding a router fails and crashes the app. First time using this tool.

Following https://openthread.io/codelabs/openthread-network-simulator#1

Running: otns -log info -listen 172.27.241.126:9000 from openthread/build/simulation/examples/apps/cli

Fails to add router with error:

info    2023-08-28 14:23:41.766 - Using env PORT_OFFSET=0
info    2023-08-28 14:23:41.767 - dispatcher listening on 172.27.241.126:9000 ...
info    2023-08-28 14:23:41.770 - dispatcher started: cfg={Speed:1 Real:false Host:172.27.241.126 Port:9000 DumpPackets:false NoPcap:false}
info    2023-08-28 14:23:41.784 - OTNS web serving on 172.27.241.126:8997 ...
info    2023-08-28 14:23:41.850 - grpcwebproxy started.
info    2023-08-28 14:23:41.930 - gRPC visualizer serving on 172.27.241.126:8999 ...
> add router x 300 y 100
info    2023-08-28 14:31:26.057 - Add: cli.AddCmd{Cmd:struct {}{}, Type:cli.NodeType{Val:"router"}, X:(*int)(0xc0001d42a0), Y:(*int)(0xc0001d42b0), Id:(*cli.AddNodeId)(nil), RadioRange:(*cli.RadioRangeFlag)(nil), Restore:(*cli.RestoreFlag)(nil), Executable:(*cli.ExecutableFlag)(nil)}
info    2023-08-28 14:31:26.063 - simulation:CtrlAddNode: &{ID:-1 X:300 Y:100 IsMtd:false IsRouter:true RxOffWhenIdle:false RadioRange:160 ExecutablePath: Restore:false}, rawMode=false
info    2023-08-28 14:31:26.063 - dispatcher add node 1
panic   2023-08-28 14:31:36.067 - expect node 1's extaddr to be valid, but failed
info    2023-08-28 14:31:36.068 - waiting for OTNS to stop gracefully ...
info    2023-08-28 14:31:36.068 - stopping simulation ...
panic   2023-08-28 14:31:36.068 -
        Error Trace:    simplelogger.go:227
                                                node.go:189
                                                node.go:163
                                                simulation.go:162
                                                panic.go:914
                                                entry.go:230
                                                sugar.go:234
                                                sugar.go:159
                                                simplelogger.go:139
                                                dispatcher.go:900
                                                simulation.go:107
                                                CmdRunner.go:317
                                                CmdRunner.go:266
                                                dispatcher.go:232
                                                simulation.go:136
                                                asm_amd64.s:1650
        Error:          Should be true

info    2023-08-28 14:31:36.068 - program context waiting routines: map[dispatcher:0 grpcwebproxy:1 handleSignals:1 simulation:1]
panic: 2023-08-28 14:31:36.067 - expect node 1's extaddr to be valid, but failed
        panic: 2023-08-28 14:31:36.068 -
        Error Trace:    simplelogger.go:227
                                                node.go:189
                                                node.go:163
                                                simulation.go:162
                                                panic.go:914
                                                entry.go:230
                                                sugar.go:234
                                                sugar.go:159
                                                simplelogger.go:139
                                                dispatcher.go:900
                                                simulation.go:107
                                                CmdRunner.go:317
                                                CmdRunner.go:266
                                                dispatcher.go:232
                                                simulation.go:136
                                                asm_amd64.s:1650
        Error:          Should be true

goroutine 14 [running]:
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0000d0000, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/zapcore/entry.go:230 +0x47f
go.uber.org/zap.(*SugaredLogger).log(0xc00011a1c8, 0x4, {0xc000014308?, 0xc0003555c8?}, {0xc0000902c0?, 0xc00004c650?, 0x10?}, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/sugar.go:234 +0x13b
go.uber.org/zap.(*SugaredLogger).Panicf(...)
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/sugar.go:159
github.com/simonlingoogle/go-simplelogger.Panicf({0xaa8224, 0x3}, {0xc00004c5f0, 0x1, 0x201?})
        /home/george/go/pkg/mod/github.com/simonlingoogle/go-simplelogger@v0.0.0-20191122025812-962af3877d65/simplelogger.go:139 +0x15d
github.com/simonlingoogle/go-simplelogger.assertLogger.Errorf(...)
        /home/george/go/pkg/mod/github.com/simonlingoogle/go-simplelogger@v0.0.0-20191122025812-962af3877d65/simplelogger.go:199
github.com/stretchr/testify/assert.Fail({0xb8d680, 0x105e4c0}, {0xab0517, 0xe}, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/github.com/stretchr/testify@v1.7.0/assert/assertions.go:262 +0x350
github.com/stretchr/testify/assert.True({0xb8d680, 0x105e4c0}, 0x0?, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/github.com/stretchr/testify@v1.7.0/assert/assertions.go:657 +0x88
github.com/simonlingoogle/go-simplelogger.AssertTrue(...)
        /home/george/go/pkg/mod/github.com/simonlingoogle/go-simplelogger@v0.0.0-20191122025812-962af3877d65/simplelogger.go:227
github.com/openthread/ot-ns/simulation.(*Node).inputCommand(0xc0002a6280, {0xaa8474, 0x4})
        /home/george/citadel/thread/otns/simulation/node.go:189 +0x56
github.com/openthread/ot-ns/simulation.(*Node).Exit(0xc0002a6280)
        /home/george/citadel/thread/otns/simulation/node.go:163 +0x28
github.com/openthread/ot-ns/simulation.(*Simulation).Stop(0xc0000b2070)
        /home/george/citadel/thread/otns/simulation/simulation.go:162 +0x9d
panic({0x9b6700?, 0xc00004c030?})
        /home/george/citadel/go/src/runtime/panic.go:914 +0x21f
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0000d0000, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/zapcore/entry.go:230 +0x47f
go.uber.org/zap.(*SugaredLogger).log(0xc00011a1c8, 0x4, {0xc0002be000?, 0x0?}, {0xc000090000?, 0x1?, 0x0?}, {0x0, 0x0, 0x0})
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/sugar.go:234 +0x13b
go.uber.org/zap.(*SugaredLogger).Panicf(...)
        /home/george/go/pkg/mod/go.uber.org/zap@v1.15.0/sugar.go:159
github.com/simonlingoogle/go-simplelogger.Panicf({0xaca0eb, 0x30}, {0xc000355cb8, 0x1, 0x6e6ee200ac?})
        /home/george/go/pkg/mod/github.com/simonlingoogle/go-simplelogger@v0.0.0-20191122025812-962af3877d65/simplelogger.go:139 +0x15d
github.com/openthread/ot-ns/dispatcher.(*Dispatcher).AddNode(0xc0001c8600, 0x27?, 0xc00019fd58?, 0x2?, 0xc000052500?)
        /home/george/citadel/thread/otns/dispatcher/dispatcher.go:900 +0x23d
github.com/openthread/ot-ns/simulation.(*Simulation).AddNode(0xc0000b2070, 0xc0000ead00?)
        /home/george/citadel/thread/otns/simulation/simulation.go:107 +0x1ec
github.com/openthread/ot-ns/cli.(*CmdRunner).executeAddNode.func1(0xc0000eb1e0?)
        /home/george/citadel/thread/otns/cli/CmdRunner.go:317 +0x25
github.com/openthread/ot-ns/cli.(*CmdRunner).executeAddNode.(*CmdRunner).postAsyncWait.func2()
        /home/george/citadel/thread/otns/cli/CmdRunner.go:266 +0x2a
github.com/openthread/ot-ns/dispatcher.(*Dispatcher).Run(0xc0001c8600)
        /home/george/citadel/thread/otns/dispatcher/dispatcher.go:232 +0x394
github.com/openthread/ot-ns/simulation.(*Simulation).Run(0xc0000b2070)
        /home/george/citadel/thread/otns/simulation/simulation.go:136 +0xae
created by github.com/openthread/ot-ns/otns_main.Main in goroutine 1
        /home/george/citadel/thread/otns/otns_main/otns_main.go:174 +0x396

Built openthread with: ./script/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON -DOT_SIMULATION_VIRTUAL_TIME_UART=ON -DOT_SIMULATION_MAX_NETWORK_SIZE=999

ga-resideo commented 1 year ago

Not sure why this issue was closed 336 as it was never resolved. Looks like I'm experiencing the same issue