Skip to content

P2P: Node crashes after receives session connectivity status #1979

Description

@anjmao

The problem is in di.go. bootstrapServices is called before bootstrapNodeComponents which inits status storage.

2020-04-01T07:53:08.856 DBG core/service/subscription.go:94          > Received P2P session status message for "p2p-session-connectivity-status": ConsumerID:"0x0987fc5db276b72835000800f7be3cf4eaca0c13"  SessionID:"79ffaea8-e906-44b9-a060-87c50f9f70fb"  Code:1000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xe1a8e4]

goroutine 4365 [running]:
github.com/mysteriumnetwork/node/core/service.subscribeSessionStatus.func1(0x1c3bb80, 0xc0009659e0, 0xc000a59b60, 0x1f)
        /Users/anjmao/go/src/github.com/mysteriumnetwork/node/core/service/subscription.go:103 +0x3a4
github.com/mysteriumnetwork/node/p2p.(*channel).handleRequest(0xc002bc7170, 0xc0001bd740)
        /Users/anjmao/go/src/github.com/mysteriumnetwork/node/p2p/channel.go:180 +0x18c
created by github.com/mysteriumnetwork/node/p2p.(*channel).readLoop
        /Users/anjmao/go/src/github.com/mysteriumnetwork/node/p2p/channel.go:123 +0xb3

Let's fix this properly (if possible) by initialising all structs before calling them in methods.

func Bootstrap() {
    di.A = NewA()
    di.B = NewB()
    di.C = NewC()
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions