nil pointer dereference in bingossiper.go

nil pointer dereference in bingossiper.go

by Jinyi Xian -
Number of replies: 0

From time to time, TestBinGossiper_Search_Query_Low_Budget fails with the following stack trace:

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=0x10 pc=0x8ea13e]
goroutine 4740 [running]:
testing.tRunner.func1.1(0xa4c660, 0xf54e10)
/usr/local/go/src/testing/testing.go:999 +0x319
testing.tRunner.func1(0xc0000a6120)
/usr/local/go/src/testing/testing.go:1002 +0x402
panic(0xa4c660, 0xf54e10)
/usr/local/go/src/runtime/panic.go:969 +0x166
go.dedis.ch/cs438/hw2/gossip.BinGossiper.GetNodes(0xaec88c, 0xb, 0xc09e576a50, 0x2c, 0x0, 0xc000551a80, 0xc0003d7800, 0xc09f5586c0, 0xbcae00, 0xc09b178e40, ...)
/builds/cs438/students/cs438-hw2-student-jxian/gossip/bingossip.go:187 +0x16e
go.dedis.ch/cs438/hw2/gossip.createNode(0xc0000a6120, 0xbc1840, 0xc09d37de60, 0xaec88c, 0xb, 0xae6f72, 0x2, 0xc0002587f8, 0x2, 0x2, ...)
/builds/cs438/students/cs438-hw2-student-jxian/gossip/gossiper_test.go:3082 +0x3d2
go.dedis.ch/cs438/hw2/gossip.createAndStartBinNode(0xc0000a6120, 0xae6f72, 0x2, 0x14, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/builds/cs438/students/cs438-hw2-student-jxian/gossip/gossiper_test.go:3035 +0x1c2
go.dedis.ch/cs438/hw2/gossip.TestBinGossiper_Search_Query_Low_Budget(0xc0000a6120)
/builds/cs438/students/cs438-hw2-student-jxian/gossip/gossiper_test.go:816 +0xa5
testing.tRunner(0xc0000a6120, 0xb13a98)
/usr/local/go/src/testing/testing.go:1050 +0xdc
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1095 +0x28b

This does not happen all the time