ergo-services / ergo

An actor-based Framework with network transparency for creating event-driven architecture in Golang. Inspired by Erlang. Zero dependencies.
https://docs.ergo.services
MIT License
3.7k stars 143 forks source link

Race condition caused segfault #3

Closed halturin closed 4 years ago

halturin commented 6 years ago

Here is details:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5639bf]

goroutine 39 [running]:
example/vendor/github.com/halturin/ergonode/dist.(*NodeDesc).GetRemoteName(...)
    /home/taras/devel/demo/example/vendor/github.com/halturin/ergonode/dist/dist.go:313
example/vendor/github.com/halturin/ergonode.(*Node).run.func2(0xc000104660, 0x5ee6e0, 0xc000114040, 0xc0000ce000, 0xc000104600)
    /home/taras/devel/demo/example/vendor/github.com/halturin/ergonode/ergonode.go:277 +0x17f
created by example/vendor/github.com/halturin/ergonode.(*Node).run
    /home/taras/devel/demo/example/vendor/github.com/halturin/ergonode/ergonode.go:266 +0x10c

these two goroutines in race condition after the link has been closed.

image

getting remote name has no checking for the 'nil' value

func (nd *NodeDesc) GetRemoteName() etf.Atom {
    return etf.Atom(nd.remote.Name)
}
halturin commented 4 years ago

is not valid anymore