Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer dereference in unit tests #6905

Open
illia-malachyn opened this issue Jan 16, 2025 · 0 comments
Open

nil pointer dereference in unit tests #6905

illia-malachyn opened this issue Jan 16, 2025 · 0 comments

Comments

@illia-malachyn
Copy link
Contributor

When I run unit tests locally, I almost always run into some nil pointer dereference errors.
Last commit on master: 0d2b34f

e.g.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xea5bfd]

goroutine 206 [running]:
github.com/dgraph-io/badger/v2/skl.(*Skiplist).IncrRef(...)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/skl/skl.go:86
github.com/dgraph-io/badger/v2.(*DB).getMemTables(0xc0000e6c08)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:626 +0xdd
github.com/dgraph-io/badger/v2.(*DB).get(0xc0000e6c08, {0xc0006fe090, 0x29, 0x29})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:661 +0x85
github.com/dgraph-io/badger/v2.(*Txn).Get(0xc0004146c0, {0xc0006fe030, 0x21, 0x30})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/txn.go:471 +0x288
github.com/onflow/flow-go/storage/badger/operation.RetrieveHeader.retrieve.func1(0xaa2bc4b2a02b3fb6?)
	/home/illia/work/flow-go/storage/badger/operation/common.go:248 +0x35
github.com/onflow/flow-go/storage/badger.NewHeaders.func3.1(0xc0004146c0)
	/home/illia/work/flow-go/storage/badger/headers.go:38 +0x42
github.com/onflow/flow-go/storage/badger.(*Cache[...]).Get.func1()
	/home/illia/work/flow-go/storage/badger/cache.go:103 +0x8e
github.com/onflow/flow-go/storage/badger.(*Headers).ByBlockID.(*Headers).retrieveTx.func1(0xc0004146c0)
	/home/illia/work/flow-go/storage/badger/headers.go:73 +0x48
github.com/onflow/flow-go/storage/badger.(*Headers).ByBlockID(0xc000230138, {0xb6, 0x3f, 0x2b, 0xa0, 0xb2, 0xc4, 0x2b, 0xaa, 0x82, ...})
	/home/illia/work/flow-go/storage/badger/headers.go:99 +0xec
github.com/onflow/flow-go/state/protocol/badger.(*FollowerState).checkBlockAlreadyProcessed(0x19c64c0?, {0xb6, 0x3f, 0x2b, 0xa0, 0xb2, 0xc4, 0x2b, 0xaa, 0x82, ...})
	/home/illia/work/flow-go/state/protocol/badger/mutator.go:409 +0x36
github.com/onflow/flow-go/state/protocol/badger.(*FollowerState).ExtendCertified(0xc000420d00, {0x7f594aa491f8?, 0xc000888540?}, 0xc00a833c80, 0xc00071bd40)
	/home/illia/work/flow-go/state/protocol/badger/mutator.go:157 +0x195
github.com/onflow/flow-go/engine/common/follower.(*ComplianceCore).processCertifiedBlocks(0xc00045cc00, {0x7f594aa491f8?, 0xc000888540?}, {0xc008e4bc08, 0x65, 0x65})
	/home/illia/work/flow-go/engine/common/follower/compliance_core.go:267 +0x40b
github.com/onflow/flow-go/engine/common/follower.(*ComplianceCore).processCoreSeqEvents(0xc00045cc00, {0x1ec7970, 0xc000888540}, 0x1?)
	/home/illia/work/flow-go/engine/common/follower/compliance_core.go:216 +0x2bd
github.com/onflow/flow-go/module/component.(*ComponentManager).Start.func2()
	/home/illia/work/flow-go/module/component/component.go:271 +0xdd
created by github.com/onflow/flow-go/module/component.(*ComponentManager).Start in goroutine 196
	/home/illia/work/flow-go/module/component/component.go:268 +0x2cc
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xea5bfd]

goroutine 173 [running]:
github.com/dgraph-io/badger/v2/skl.(*Skiplist).IncrRef(...)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/skl/skl.go:86
github.com/dgraph-io/badger/v2.(*DB).getMemTables(0xc0000e6c08)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:626 +0xdd
github.com/dgraph-io/badger/v2.(*DB).get(0xc0000e6c08, {0xc0006ce0f0, 0x29, 0x29})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:661 +0x85
github.com/dgraph-io/badger/v2.(*Txn).Get(0xc00b9a42d0, {0xc0006ce090, 0x21, 0x30})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/txn.go:471 +0x288
github.com/onflow/flow-go/storage/badger/operation.LookupLatestSealAtBlock.retrieve.func1(0xc0000e6c08?)
	/home/illia/work/flow-go/storage/badger/operation/common.go:248 +0x35
github.com/dgraph-io/badger/v2.(*DB).View(0x81a30dcf7af765bc?, 0xc0001e60c0)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/txn.go:802 +0x95
github.com/onflow/flow-go/storage/badger.(*Seals).HighestInFork(0xc000900120, {0xbc, 0x65, 0xf7, 0x7a, 0xcf, 0xd, 0xa3, 0x81, 0xf8, ...})
	/home/illia/work/flow-go/storage/badger/seals.go:75 +0x5c
github.com/onflow/flow-go/state/protocol/badger.(*FollowerState).Finalize(0xc000420d00, {0x1ec0860?, 0x2cbb8a0?}, {0xbc, 0x65, 0xf7, 0x7a, 0xcf, 0xd, 0xa3, ...})
	/home/illia/work/flow-go/state/protocol/badger/mutator.go:695 +0x29f
github.com/onflow/flow-go/module/finalizer/consensus.(*Finalizer).MakeFinal(0xc0002543c0, {0xbc, 0x65, 0xf7, 0x7a, 0xcf, 0xd, 0xa3, 0x81, 0xf8, ...})
	/home/illia/work/flow-go/module/finalizer/consensus/finalizer.go:116 +0x91b
github.com/onflow/flow-go/consensus/hotstuff/forks.(*Forks).checkForAdvancingFinalization(0xc000770280, 0xc00b083550)
	/home/illia/work/flow-go/consensus/hotstuff/forks/forks.go:442 +0x462
github.com/onflow/flow-go/consensus/hotstuff/forks.(*Forks).AddCertifiedBlock(0xc000770280, 0xc00b083550)
	/home/illia/work/flow-go/consensus/hotstuff/forks/forks.go:218 +0x2aa
github.com/onflow/flow-go/consensus/hotstuff.(*FollowerLoop).loop(0xc000165c20, {0x1ec7970, 0xc000888408}, 0x4df001?)
	/home/illia/work/flow-go/consensus/hotstuff/follower_loop.go:107 +0x199
github.com/onflow/flow-go/module/component.(*ComponentManager).Start.func2()
	/home/illia/work/flow-go/module/component/component.go:271 +0xdd
created by github.com/onflow/flow-go/module/component.(*ComponentManager).Start in goroutine 168
	/home/illia/work/flow-go/module/component/component.go:268 +0x2cc
FAIL	github.com/onflow/flow-go/engine/common/follower	60.526s
ok  	github.com/onflow/flow-go/engine/common/follower/cache	0.386s	coverage: 2.0% of statements
ok  	github.com/onflow/flow-go/engine/common/follower/pending_tree	0.269s	coverage: 1.6% of statements
ok  	github.com/onflow/flow-go/engine/common/provider	0.240s	coverage: 2.5% of statements
ok  	github.com/onflow/flow-go/engine/common/requester	0.484s	coverage: 2.6% of statements
ok  	github.com/onflow/flow-go/engine/common/rpc	4.971s	coverage: 2.1% of statements
ok  	github.com/onflow/flow-go/engine/common/rpc/convert	0.496s	coverage: 6.0% of statements
ok  	github.com/onflow/flow-go/engine/common/stop	0.234s	coverage: 1.2% of statements
ok  	github.com/onflow/flow-go/engine/common/synchronization	76.207s	coverage: 5.4% of statements
ok  	github.com/onflow/flow-go/engine/common/version	2.233s	coverage: 2.1% of statements
ok  	github.com/onflow/flow-go/engine/common/worker	0.297s	coverage: 1.4% of statements
ok  	github.com/onflow/flow-go/engine/consensus/approvals	7.588s	coverage: 7.3% of statements
ok  	github.com/onflow/flow-go/engine/consensus/compliance	0.375s	coverage: 3.2% of statements
ok  	github.com/onflow/flow-go/engine/consensus/dkg	0.403s	coverage: 5.3% of statements
ok  	github.com/onflow/flow-go/engine/consensus/ingestion	0.355s	coverage: 3.0% of statements
ok  	github.com/onflow/flow-go/engine/consensus/matching	3.368s	coverage: 4.1% of statements
ok  	github.com/onflow/flow-go/engine/consensus/message_hub	0.338s	coverage: 3.1% of statements
ok  	github.com/onflow/flow-go/engine/consensus/sealing	8.054s	coverage: 5.9% of statements
ok  	github.com/onflow/flow-go/engine/execution	16.703s	coverage: 3.3% of statements
ok  	github.com/onflow/flow-go/engine/execution/checker	0.350s	coverage: 2.4% of statements
ok  	github.com/onflow/flow-go/engine/execution/computation	21.380s	coverage: 4.2% of statements
ok  	github.com/onflow/flow-go/engine/execution/computation/committer	0.321s	coverage: 1.4% of statements
ok  	github.com/onflow/flow-go/engine/execution/computation/computer	3.301s	coverage: 4.0% of statements
ok  	github.com/onflow/flow-go/engine/execution/computation/metrics	0.715s	coverage: 1.6% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion	0.669s	coverage: 3.9% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion/block_queue	0.312s	coverage: 2.2% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion/fetcher	0.637s	coverage: 1.4% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion/loader	0.620s	coverage: 2.9% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion/stop	0.366s	coverage: 2.8% of statements
ok  	github.com/onflow/flow-go/engine/execution/ingestion/uploader	0.746s	coverage: 3.6% of statements
ok  	github.com/onflow/flow-go/engine/execution/provider	0.309s	coverage: 2.8% of statements
ok  	github.com/onflow/flow-go/engine/execution/rpc	0.297s	coverage: 4.9% of statements
ok  	github.com/onflow/flow-go/engine/execution/state	1.621s	coverage: 3.2% of statements
ok  	github.com/onflow/flow-go/engine/execution/state/bootstrap	1.684s	coverage: 1.7% of statements
ok  	github.com/onflow/flow-go/engine/execution/storehouse	1.900s	coverage: 2.9% of statements
ok  	github.com/onflow/flow-go/engine/protocol	0.698s	coverage: 2.0% of statements
ok  	github.com/onflow/flow-go/engine/verification/assigner	0.542s	coverage: 1.3% of statements
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xf2361d]

goroutine 9620 [running]:
github.com/dgraph-io/badger/v2/skl.(*Skiplist).IncrRef(...)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/skl/skl.go:86
github.com/dgraph-io/badger/v2.(*DB).getMemTables(0xc000febc08)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:626 +0xdd
github.com/dgraph-io/badger/v2.(*DB).get(0xc000febc08, {0xc0408ecf00, 0x2f, 0x2f})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/db.go:661 +0x85
github.com/dgraph-io/badger/v2.(*Txn).Get(0xc0408fdc20, {0xc0408eced0, 0x27, 0x30})
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/txn.go:471 +0x288
github.com/onflow/flow-go/storage/badger/operation.SetProcessedIndex.update.func1(0xc0408fdc20)
	/home/illia/work/flow-go/storage/badger/operation/common.go:101 +0x51
github.com/dgraph-io/badger/v2.(*DB).Update(0x1f9d046?, 0xc0408eaf90)
	/home/illia/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/txn.go:818 +0x8d
github.com/onflow/flow-go/storage/badger/operation.RetryOnConflict(0xc011837c38, 0xc0408eaf90)
	/home/illia/work/flow-go/storage/badger/operation/modifiers.go:50 +0x3a
github.com/onflow/flow-go/storage/badger.(*ConsumerProgress).SetProcessedIndex(0xc023edf4a0, 0x1f5c0e5?)
	/home/illia/work/flow-go/storage/badger/consumer_progress.go:44 +0x59
github.com/onflow/flow-go/module/jobqueue.(*Consumer).run(0xc0004b8e10)
	/home/illia/work/flow-go/module/jobqueue/consumer.go:257 +0x343
github.com/onflow/flow-go/module/jobqueue.(*Consumer).checkProcessable(0xc0004b8e10)
	/home/illia/work/flow-go/module/jobqueue/consumer.go:207 +0x4f
github.com/onflow/flow-go/module/jobqueue.(*Consumer).NotifyJobIsDone(0xc0004b8e10, {0xc0413b7380, 0x40})
	/home/illia/work/flow-go/module/jobqueue/consumer.go:171 +0xe5
github.com/onflow/flow-go/engine/verification/assigner/blockconsumer.(*BlockConsumer).NotifyJobIsDone(0xc000766240, {0xc0413b7380?, 0xc000602e58?})
	/home/illia/work/flow-go/engine/verification/assigner/blockconsumer/consumer.go:84 +0x63
github.com/onflow/flow-go/engine/verification/assigner/blockconsumer.(*worker).Notify(0xc0003b3470, {0x1d, 0x9e, 0xce, 0x3, 0xa9, 0xcc, 0x7f, 0x10, 0x6b, ...})
	/home/illia/work/flow-go/engine/verification/assigner/blockconsumer/worker.go:50 +0xd4
github.com/onflow/flow-go/engine/verification/assigner/blockconsumer_test.TestProduceConsume.func2.1.1()
	/home/illia/work/flow-go/engine/verification/assigner/blockconsumer/consumer_test.go:83 +0xaf
created by github.com/onflow/flow-go/engine/verification/assigner/blockconsumer_test.TestProduceConsume.func2.1 in goroutine 9065
	/home/illia/work/flow-go/engine/verification/assigner/blockconsumer/consumer_test.go:82 +0x1d6
FAIL	github.com/onflow/flow-go/engine/verification/assigner/blockconsumer	40.248s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant