ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.39k stars 20.05k forks source link

Panic when sendingtransaction at early start (develop) #3428

Closed Magicking closed 7 years ago

Magicking commented 7 years ago

System information

Geth version: Geth/JIT/v1.5.5-unstable-a98e8c08 OS & Version: Linux Alpine Commit hash : a98e8c08

Expected behaviour

Keep Transaction in mempool and not panic

Actual behaviour

Panic

Steps to reproduce the behaviour

Generate a genesis with custom address Try to send a transaction while the node has no block on disk (except genesis ?)

Backtrace

import genesis
1213 01:39:05.380422 cmd/utils/flags.go:615] WARNING: No etherbase set and no accounts found as default
1213 01:39:05.380506 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /datadir/geth/chaindata
1213 01:39:05.386605 ethdb/database.go:176] closed db:/datadir/geth/chaindata
1213 01:39:05.386701 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /datadir/geth/chaindata
1213 01:39:05.396428 cmd/geth/chaincmd.go:131] successfully wrote genesis block and/or chain rule set: ea0a20dd773f6395ec042063668d5983a34b31349cdafb04f808f00d8b00c838
 enode://29909e2bbb706683d31cc62bdcbdb9276e810fbaa4651d57ee0f71cb72b64f52a6a1339d98dd777333b4eea533db70bfc30e209e54251b48374c18a58a1e3f17@172.19.0.3:30303 #
1213 01:39:06.368767 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /datadir/geth/chaindata
1213 01:39:06.379208 ethdb/database.go:176] closed db:/datadir/geth/chaindata
1213 01:39:06.379560 node/node.go:176] instance: Geth/JIT/v1.5.5-unstable-a98e8c08/linux/go1.6.3
1213 01:39:06.379588 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /datadir/geth/chaindata
1213 01:39:06.389496 eth/db_upgrade.go:346] upgrading db log bloom bins
1213 01:39:06.389613 eth/db_upgrade.go:354] upgrade completed in 120.098µs
1213 01:39:06.389650 eth/backend.go:191] Protocol Versions: [63 62], Network Id: 1900
1213 01:39:06.389799 eth/backend.go:219] Chain config: {ChainID: 0 Homestead: <nil> DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil>}
1213 01:39:06.390062 core/blockchain.go:219] Last header: #0 [ea0a20dd…] TD=1024
1213 01:39:06.390077 core/blockchain.go:220] Last block: #0 [ea0a20dd…] TD=1024
1213 01:39:06.390090 core/blockchain.go:221] Fast block: #0 [ea0a20dd…] TD=1024
1213 01:39:06.390644 p2p/server.go:342] Starting Server
1213 01:39:06.396083 p2p/discover/udp.go:227] Listening, enode://2d2921306cc7ea0b8a186676fd1fee9aa83444149f65212264c4d3278e0b5c151029df82a9bdccc24761d72794b6da63b6a140837b66b88806c87
a30da8e3c49@[::]:30303
1213 01:39:06.396257 p2p/server.go:610] Listening on [::]:30303
1213 01:39:06.396440 eth/backend.go:475] Automatic pregeneration of ethash DAG ON (ethash dir: /root/.ethash)
1213 01:39:06.396470 eth/backend.go:482] checking DAG (ethash dir: /root/.ethash)
1213 01:39:06.397738 node/node.go:411] HTTP endpoint opened: http://0.0.0.0:8545
1213 01:39:06.397842 node/node.go:341] IPC endpoint opened: /datadir/geth.ipc
1213 01:39:06.398034 node/node.go:465] WebSocket endpoint opened: ws://0.0.0.0:8546
1213 01:39:07.256722 cmd/geth/accountcmd.go:200] Unlocked account 5d9dac3a6d4332ef830d043b882d9bbbf9991b33
1213 01:39:07.256818 miner/miner.go:137] Starting mining operation (CPU=1 TOT=2)
1213 01:39:07.257094 miner/worker.go:570] commit new work on block 1 with 0 txs & 0 uncles. Took 257.351µs
1213 01:39:07.257138 vendor/github.com/ethereum/ethash/ethash.go:259] Generating DAG for epoch 0 (size 1073739904) (0000000000000000000000000000000000000000000000000000000000000000)
1213 01:39:07.954580 vendor/github.com/ethereum/ethash/ethash.go:291] Generating DAG: 0%
1213 01:39:11.294690 vendor/github.com/ethereum/ethash/ethash.go:291] Generating DAG: 1%
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x55eb2b]

goroutine 115 [running]:
panic(0xfa3620, 0xc820010090)
        /usr/lib/go/src/runtime/panic.go:481 +0x3e6
github.com/ethereum/go-ethereum/core/state.(*ManagedState).GetNonce(0x0, 0x66d0ad218f7e8520, 0xea6a4bf310a42a4f, 0xdacba498, 0x0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/core/state/managed_state.go:87 +0x15b
github.com/ethereum/go-ethereum/core.(*TxPool).promoteExecutables(0xc820184160, 0xc820330ff0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/core/tx_pool.go:546 +0x547
github.com/ethereum/go-ethereum/core.(*TxPool).Add(0xc820184160, 0xc82088e000, 0x0, 0x0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/core/tx_pool.go:428 +0x119
github.com/ethereum/go-ethereum/eth.(*EthApiBackend).SendTx(0xc82044f3b0, 0x7f27d4f4a5a8, 0xc82027d110, 0xc82088e000, 0x0, 0x0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/eth/api_backend.go:124 +0xbe
github.com/ethereum/go-ethereum/internal/ethapi.(*PublicTransactionPoolAPI).SendRawTransaction(0xc82025e1c0, 0x7f27d4f4a5a8, 0xc82027d110, 0xc820882400, 0x1176, 0x0, 0x0, 0x0, 0x0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/internal/ethapi/api.go:1094 +0x1ae
reflect.Value.call(0xf56820, 0x10d1018, 0x13, 0x111b818, 0x4, 0xc8202d4120, 0x3, 0x4, 0x0, 0x0, ...)
        /usr/lib/go/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0xf56820, 0x10d1018, 0x13, 0xc8202d4120, 0x3, 0x4, 0x0, 0x0, 0x0)
        /usr/lib/go/src/reflect/value.go:303 +0xb1
github.com/ethereum/go-ethereum/rpc.(*Server).handle(0xc820423770, 0x7f27d4f4a5a8, 0xc82027d110, 0x7f27d4f4a4d0, 0xc82043af50, 0xc82015c070, 0x0, 0x0, 0x0)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/rpc/server.go:318 +0x1268
github.com/ethereum/go-ethereum/rpc.(*Server).exec(0xc820423770, 0x7f27d4f4a5a8, 0xc82027d110, 0x7f27d4f4a4d0, 0xc82043af50, 0xc82015c070)
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/rpc/server.go:340 +0x277
created by github.com/ethereum/go-ethereum/rpc.(*Server).serveRequest
        /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/rpc/server.go:213 +0xd85
Magicking commented 7 years ago

The panic did not occur at 3363a1c2277ccd3aee9e05850accd8c50e016bfa (previous used build). The panic also doesn't occur when at least 1 block has been imported / mined