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

Fix concurrent access to blockCtx in debug_traceBlock #284

Merged

Conversation

hkalina
Copy link
Contributor

@hkalina hkalina commented Apr 11, 2022

Fix nil panics caused by concurrent access to blockCtx (and GetHashFn function in it).

This is related to following panics:

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

goroutine 212151913 [running]:
github.com/Fantom-foundation/go-opera/evmcore.GetHashFn.func1(0x1adf0d9)
	/go/go-opera/evmcore/evm.go:78 +0x126
github.com/ethereum/go-ethereum/core/vm.opBlockhash(0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/!fantom-foundation/go-ethereum@v1.10.8-ftm-rc4/core/vm/instructions.go:448 +0xa6
github.com/ethereum/go-ethereum/core/vm.(*EVMInterpreter).Run(0xc01201e000, 0xc051d3fa40, {0xc04a20a3c0, 0x44, 0x44}, 0x0)
	/go/pkg/mod/github.com/!fantom-foundation/go-ethereum@v1.10.8-ftm-rc4/core/vm/interpreter.go:263 +0xac4
github.com/ethereum/go-ethereum/core/vm.(*EVM).Call(0xc08885ea80, {0x157c340, 0xc0aed6a930}, {0x24, 0x1, 0x7c, 0x94, 0x10, 0x8c, 0xef, ...}, ...)
	/go/pkg/mod/github.com/!fantom-foundation/go-ethereum@v1.10.8-ftm-rc4/core/vm/evm.go:237 +0xceb
github.com/Fantom-foundation/go-opera/evmcore.(*StateTransition).TransitionDb(0xc0753cb730)
	/go/go-opera/evmcore/state_transition.go:292 +0x58e
github.com/Fantom-foundation/go-opera/evmcore.ApplyMessage(0xc07401b440, {0x15b3da0, 0xc07401b440}, 0x0)
	/go/go-opera/evmcore/state_transition.go:173 +0x32
github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).traceTx(0xc03c3fa010, {0x159a998, 0xc0a0c99680}, {0x15b3da0, 0xc07401b440}, 0xc00c529df8, {0x1429ba0, 0x1429ba8, 0xc06d497e00, {0x0, ...}, ...}, ...)
	/go/go-opera/ethapi/api.go:2070 +0x5a9
github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).traceBlock.func1()
	/go/go-opera/ethapi/api.go:2196 +0x406
created by github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).traceBlock
	/go/go-opera/ethapi/api.go:2186 +0x2c5

@hkalina
Copy link
Contributor Author

hkalina commented Apr 11, 2022

For reference, there is also similar issue and fix in go-ethereum from January: ethereum/go-ethereum#24286

@uprendis uprendis merged commit a8e1398 into Fantom-foundation:release/txtracing/1.1.0-rc.4 Apr 11, 2022
@hkalina hkalina deleted the debug-api-fix branch April 11, 2022 19:03
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

Successfully merging this pull request may close these issues.

None yet

2 participants