Runtime error: invalid memory address or nil pointer dereference

Situation

When I perform a test of the zping service that is bundled with the goloang SDK, I receive the following error

The error is triggered when I start the server process

sudo ./zping server -c “$HOME/ssh.server.id.json”

> I am running Goloang 1.18… so not sure if this will cause any problems like this.

Checking if anyone can reproduce this error.

I had something similar a few hours ago that was related to SELinux, but I believe I have this sorted now.

PS… I have been able to successfully use the curlz command… so I am not sure what is happening

Maybe… I need to have some more changes made but I am not 100% sure… its been a while since I had this working

Here is a list of the configurations used to setup the service for testing

ziti edge create config ziti-ping-host.v1 host.v1 '{"protocol":"tcp", "address":"127.0.0.1","port":22, "listenOptions": {"bindUsingEdgeIdentity":true} }'

ziti edge create service ziti-ping --configs ziti-ping-host.v1

ziti edge create service-policy ziti-ping-binding Bind --identity-roles '@ssh.server.id' --service-roles '@ziti-ping' 

ziti edge create service-policy ziti-ping-dialing Dial  --identity-roles '@ssh.client.id' --service-roles '@ziti-ping'
[ 4.262] INFO fabric/controller/network.(*Network).Run: {routerId=[8Zo-gTL0Ck]} changed router

[ 45.210] ERROR fabric/controller/command.(*LocalDispatcher).Dispatch.func1: {error=[runtime error: invalid memory address or nil pointer dereference] cmdType=[*model.CreateEdgeTerminatorCmd]} error while dispatching command of type

goroutine 325 [running]:

github.com/openziti/foundation/v2/debugz.generateStack(0x2000, 0x40?)

github.com/openziti/foundation/v2@v2.0.4/debugz/stack.go:38 +0x4a

github.com/openziti/foundation/v2/debugz.GenerateLocalStack(...)

github.com/openziti/foundation/v2@v2.0.4/debugz/stack.go:33

github.com/openziti/foundation/v2/debugz.DumpLocalStack()

github.com/openziti/foundation/v2@v2.0.4/debugz/stack.go:52 +0x25

github.com/openziti/fabric/controller/command.(*LocalDispatcher).Dispatch.func1()

github.com/openziti/fabric@v0.20.0/controller/command/command.go:60 +0x2c5

panic({0x217e540, 0x367a440})

runtime/panic.go:884 +0x212

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).getTerminatorSession(0xc000bf9fc8, 0x7fc66021fe30?, {0x28b3758, 0xc0028c42d0}, {0x243d3da, 0x8})

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:84 +0x33e

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).validateTerminatorIdentity(0xc000bf9fc8, 0x28b6c20?, 0xc002ea9a40)

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:42 +0x138

github.com/openziti/fabric/controller/network.(*TerminatorManager).ApplyCreate.func1(0xc003348700)

github.com/openziti/fabric@v0.20.0/controller/network/terminator.go:146 +0x24f

go.etcd.io/bbolt.(*DB).Update(0x18?, 0xc000bf9fe0)

go.etcd.io/bbolt@v1.3.6/db.go:741 +0x82

github.com/openziti/storage/boltz.(*DbImpl).Update(0x2226860?, 0xc003347601?)

github.com/openziti/storage@v0.1.21/boltz/db.go:103 +0x96

github.com/openziti/fabric/controller/network.(*TerminatorManager).ApplyCreate(0xc000212f40, 0xc000bb2de0)

github.com/openziti/fabric@v0.20.0/controller/network/terminator.go:138 +0x8b

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).Apply(0xc000bf9fc8)

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:27 +0x105

github.com/openziti/fabric/controller/command.(*LocalDispatcher).Dispatch(0xc00031d110?, {0x28aa650?, 0xc000bf9fc8?})

github.com/openziti/fabric@v0.20.0/controller/command/command.go:77 +0x147

github.com/openziti/fabric/controller/network.(*Managers).Dispatch(...)

github.com/openziti/fabric@v0.20.0/controller/network/managers.go:58

github.com/openziti/edge/controller/handler_edge_ctrl.(*createTerminatorHandler).CreateTerminator(0xc00110ecc0, 0xc00229e5a0)

github.com/openziti/edge@v0.23.0/controller/handler_edge_ctrl/create_terminator.go:116 +0x9a2

created by github.com/openziti/edge/controller/handler_edge_ctrl.(*createTerminatorHandler).HandleReceive

github.com/openziti/edge@v0.23.0/controller/handler_edge_ctrl/create_terminator.go:68 +0x2df

panic: runtime error: invalid memory address or nil pointer dereference [recovered]

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0xb8 pc=0x1bc083e]

goroutine 325 [running]:

github.com/openziti/fabric/controller/command.(*LocalDispatcher).Dispatch.func1()

github.com/openziti/fabric@v0.20.0/controller/command/command.go:61 +0x2d4

panic({0x217e540, 0x367a440})

runtime/panic.go:884 +0x212

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).getTerminatorSession(0xc000bf9fc8, 0x7fc66021fe30?, {0x28b3758, 0xc0028c42d0}, {0x243d3da, 0x8})

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:84 +0x33e

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).validateTerminatorIdentity(0xc000bf9fc8, 0x28b6c20?, 0xc002ea9a40)

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:42 +0x138

github.com/openziti/fabric/controller/network.(*TerminatorManager).ApplyCreate.func1(0xc003348700)

github.com/openziti/fabric@v0.20.0/controller/network/terminator.go:146 +0x24f

go.etcd.io/bbolt.(*DB).Update(0x18?, 0xc000bf9fe0)

go.etcd.io/bbolt@v1.3.6/db.go:741 +0x82

github.com/openziti/storage/boltz.(*DbImpl).Update(0x2226860?, 0xc003347601?)

github.com/openziti/storage@v0.1.21/boltz/db.go:103 +0x96

github.com/openziti/fabric/controller/network.(*TerminatorManager).ApplyCreate(0xc000212f40, 0xc000bb2de0)

github.com/openziti/fabric@v0.20.0/controller/network/terminator.go:138 +0x8b

github.com/openziti/edge/controller/model.(*CreateEdgeTerminatorCmd).Apply(0xc000bf9fc8)

github.com/openziti/edge@v0.23.0/controller/model/create_terminator_cmd.go:27 +0x105

github.com/openziti/fabric/controller/command.(*LocalDispatcher).Dispatch(0xc00031d110?, {0x28aa650?, 0xc000bf9fc8?})

github.com/openziti/fabric@v0.20.0/controller/command/command.go:77 +0x147

github.com/openziti/fabric/controller/network.(*Managers).Dispatch(...)

github.com/openziti/fabric@v0.20.0/controller/network/managers.go:58

github.com/openziti/edge/controller/handler_edge_ctrl.(*createTerminatorHandler).CreateTerminator(0xc00110ecc0, 0xc00229e5a0)

github.com/openziti/edge@v0.23.0/controller/handler_edge_ctrl/create_terminator.go:116 +0x9a2

created by github.com/openziti/edge/controller/handler_edge_ctrl.(*createTerminatorHandler).HandleReceive

github.com/openziti/edge@v0.23.0/controller/handler_edge_ctrl/create_terminator.go:68 +0x2df

Hi @markamind, thank you for posting the stack trace and the config you were using. I’ve put in a fix for the issue here: Panic when creating sdk hosted terminator · Issue #1186 · openziti/edge · GitHub

Cheers,
Paul

2 Likes