erigon icon indicating copy to clipboard operation
erigon copied to clipboard

runtime error: invalid memory address or nil pointer dereference

Open academe-01 opened this issue 5 months ago • 4 comments

System information

Erigon version: ./erigon --version current devel branch & 2.57.3

OS & Version: Windows/Linux/OSX MacOS

Commit hash:

Erigon Command (with flags/config): erigon --db.size.limit=4TB --internalcl --chain=sepolia --snapshots=true

Backtrace

INFO[02-05|15:15:50.029] logging to file system                   log dir=/Users/x/erigon/sepolia_original/logs file prefix=erigon log level=info json=false
INFO[02-05|15:15:50.029] Build info                               git_branch= git_tag= git_commit=
INFO[02-05|15:15:50.029] Starting Erigon on Sepolia testnet... 
INFO[02-05|15:15:50.032] Maximum peer count                       ETH=100 total=100
INFO[02-05|15:15:50.032] starting HTTP APIs                       port=8547 APIs=eth,debug,net,trace,web3,erigon,ots,ots2
INFO[02-05|15:15:50.032] torrent verbosity                        level=WRN
INFO[02-05|15:15:52.390] [torrent] Public IP                      ip=1.1.1.1
INFO[02-05|15:15:52.391] Set global gas cap                       cap=50000000
INFO[02-05|15:15:52.392] [Downloader] Running with                ipv6-enabled=true ipv4-enabled=true download.rate=140mb upload.rate=4mb
INFO[02-05|15:15:52.392] Opening Database                         label=chaindata path=/Users/x/erigon/sepolia_original/chaindata
INFO[02-05|15:15:52.393] [db] open                                lable=chaindata sizeLimit=4TB pageSize=16384
INFO[02-05|15:15:52.394] Initialised chain configuration          config="{ChainID: 11155111, Homestead: 0, DAO: <nil>, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: 0, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: 17000000000000000, Merge Netsplit: 1735371, Shanghai: 1677557088, Cancun: 1706655072, Prague: <nil>, Engine: ethash}" genesis=0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9
INFO[02-05|15:15:52.901] Initialising Ethereum protocol           network=11155111
INFO[02-05|15:15:52.901] Disk storage enabled for ethash DAGs     dir=/Users/x/erigon/sepolia_original/ethash-dags count=2
INFO[02-05|15:15:52.904] Starting private RPC server              on=127.0.0.1:9092
INFO[02-05|15:15:52.904] new subscription to logs established 

> [unrecovered-panic] runtime.fatalpanic() /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/panic.go:1188 (hits goroutine(1557):1 total:1) (PC: 0x104d35790)
Warning: debugging optimized function
	runtime.curg._panic.arg: interface {}(string) "runtime error: invalid memory address or nil pointer dereference"
  1183:	// fatalpanic implements an unrecoverable panic. It is like fatalthrow, except
  1184:	// that if msgs != nil, fatalpanic also prints panic messages and decrements
  1185:	// runningPanicDefers once main is blocked from exiting.
  1186:	//
  1187:	//go:nosplit
=>1188:	func fatalpanic(msgs *_panic) {
  1189:		pc := getcallerpc()
  1190:		sp := getcallersp()
  1191:		gp := getg()
  1192:		var docrash bool
  1193:		// Switch to the system stack to avoid any stack growth, which
(dlv) stack
 0  0x0000000104d35790 in runtime.fatalpanic
    at /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/panic.go:1188
 1  0x0000000104d350a8 in runtime.gopanic
    at /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/panic.go:1017
 2  0x0000000104d339b8 in runtime.panicmem
    at /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/panic.go:261
 3  0x0000000104d4c6a0 in runtime.sigpanic
    at /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/signal_unix.go:861
 4  0x0000000105f1aea8 in github.com/ledgerwatch/erigon/consensus/misc.eip1559Calculator.CurrentFees
    at ./consensus/misc/eip1559.go:80
 5  0x0000000105f1aea8 in github.com/ledgerwatch/erigon/consensus/misc.eip1559Calculator.CurrentFees
    at ./consensus/misc/eip1559.go:80
 6  0x0000000105f1ae20 in github.com/ledgerwatch/erigon/consensus/misc.eip1559Calculator.CurrentFees
    at ./consensus/misc/eip1559.go:73
 7  0x000000000000b58a in ???
    at ?:-1
 8  0x0000000105e77f08 in github.com/ledgerwatch/erigon-lib/kv/mdbx.(*MdbxKV).View
    at ./erigon-lib/kv/mdbx/kv_mdbx.go:749
 9  0x00000140000d6f00 in ???
    at ?:-1
10  0x000000010613853c in github.com/ledgerwatch/erigon-lib/txpool.(*TxPool).Start
    at ./erigon-lib/txpool/pool.go:319
11  0x0000000108075cf0 in ???
    at ?:-1
12  0x0000000106148d3c in github.com/ledgerwatch/erigon-lib/txpool.MainLoop
    at ./erigon-lib/txpool/pool.go:1729
13  0x0000064009540a80 in ???
    at ?:-1
14  0x0000000104d6b814 in runtime.goexit
    at /opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197
    error: Undefined return address at 0x104d6b814
(truncated)

Proposed fix:

Subject: [PATCH] fix eip
---
Index: consensus/misc/eip1559.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go
--- a/consensus/misc/eip1559.go	(revision 8e1203f1ea69915e72d3c8705c7ecd717f637e9c)
+++ b/consensus/misc/eip1559.go	(revision e36d3c54636e698afad5398544924bd0c025f56c)
@@ -72,7 +72,7 @@
 
 	currentHeader, err := rawdb.ReadHeaderByHash(db, hash)
 
-	if err != nil {
+	if err != nil || currentHeader == nil {
 		return 0, 0, 0, 0, err
 	}
 

academe-01 avatar Feb 05 '24 13:02 academe-01