Test with 10000 transactions/ hour causes unexpected behaviour
System information
Geth version: geth version
Version: 1.7.2-stable
Git Commit: ee498061b5a74bf1f3290139a53840345fa038cb
Quorum Version: 2.0.1
Architecture: amd64
Network Id: 1
Go Version: go1.7.3
Operating System: linux
OS & Version: Linux Ubuntu
System stats: RAM: 4GB HDD: 8 SSD Processor: 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor CPU cores: 2 Number of nodes: 3 Consensus: Raft
Expected behaviour
I did a test with 10000 transactions spread over a period of 1 hour, i.e., around 200 transactions per minute. Initial test with just 200 transactions in 1 minute succeeded. So, to test system limits, I tried to do around 10,000 transactions with 200 transactions occurring every minute.
Actual behaviour
Around 9000 transactions succeeds. However, the rest are still in the pending/queued txpool and is not moving. Moreover, any new transaction is not possible to.
Steps to reproduce the behaviour
- I am running this script https://github.com/mohdrashid/measure_request_time with some modifications
- The script calls an api that creates new contracts using web3 1.0
- The script is modified to send 200 transactions every minute.
- After around 9000 transactions it fails to process rest and some are still in txpool pending list
- After the test, it does not entertain any more transactions and gives the output as below
Backtrace from API
2|quorum | Error: Invalid JSON RPC response: ""
2|quorum | at Object.InvalidResponse (/home/avanza/quorum-apis/node_modules/web3-core-helpers/src/errors.js:42:16)
2|quorum | at XMLHttpRequest.request.onreadystatechange (/home/avanza/quorum-apis/node_modules/web3-providers-http/src/index.js:73:32)
2|quorum | at XMLHttpRequestEventTarget.dispatchEvent (/home/avanza/quorum-apis/node_modules/xhr2/lib/xhr2.js:64:18)
2|quorum | at XMLHttpRequest._setReadyState (/home/avanza/quorum-apis/node_modules/xhr2/lib/xhr2.js:354:12)
2|quorum | at XMLHttpRequest._onHttpRequestError (/home/avanza/quorum-apis/node_modules/xhr2/lib/xhr2.js:544:12)
2|quorum | at ClientRequest.<anonymous> (/home/avanza/quorum-apis/node_modules/xhr2/lib/xhr2.js:414:24)
2|quorum | at ClientRequest.emit (events.js:160:13)
2|quorum | at Socket.socketErrorListener (_http_client.js:389:9)
2|quorum | at Socket.emit (events.js:160:13)
2|quorum | at emitErrorNT (internal/streams/destroy.js:64:8)
2|quorum | at process._tickCallback (internal/process/next_tick.js:152:19)
Backtrace from quorum logs
########## BAD BLOCK #########
Chain config: {ChainID: 1 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil> Byzantium: <nil> IsQuorum: true Engine: unknown}
Number: 4726
Hash: 0x8b67334973dd388bb844d39b2f6e4346c956defd291d0aa23839d03a7b9f065b
Error: gas limit reached
##############################
panic: failed to extend chain: gas limit reached
goroutine 1118 [running]:
panic(0xe9ee40, 0xc4359be4d0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/ethereum/go-ethereum/raft.(*ProtocolManager).applyNewChainHead(0xc420af2420, 0xc420a64f30)
/home/avanza/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:869 +0x62a
github.com/ethereum/go-ethereum/raft.(*ProtocolManager).eventLoop(0xc420af2420)
/home/avanza/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:723 +0x9f4
created by github.com/ethereum/go-ethereum/raft.(*ProtocolManager).startRaft
/home/avanza/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:482 +0x90c
It also gives error such as
WARN [04-03|14:24:00] Failed to journal local transaction err="no active journal"
When I go to geth console and type txpool, it gives
status: {
pending: 0,
queued: 64
}
However, it does not process these queued transactions once I stop creating new transactions.
After re-initializing the blockchain, I performed similar test and made the following observation. After removing the load after continuous bombardment of requests, the transactions fails to move from pending list in txpool unless a new request is made.
@mohdrashid thanks for the detailed report. I haven't seen this issue with Raft running before, we'll look into it.
Here is another set of logs obtained with another run
INFO [04-12|10:31:44] Handling InvalidRaftOrdering invalid block=75d01d…bc96a6 current head=f19641…d7d6b9
INFO [04-12|10:31:44] Someone else mined invalid block; ignoring block=75d01d…bc96a6
INFO [04-12|10:31:45] Non-extending block block=9ada76…4352db parent=9dc97b…3766ee head=f19641…d7d6b9
INFO [04-12|10:31:45] persisted the latest applied index index=1814
INFO [04-12|10:31:45] Handling InvalidRaftOrdering invalid block=9ada76…4352db current head=f19641…d7d6b9
INFO [04-12|10:31:45] Someone else mined invalid block; ignoring block=9ada76…4352db
After this happens, It no longer process any pending transactions.
During another run with RAFT,
this is the result obtained:
INFO [04-15|17:08:06] TX failed, will be removed hash=430fc6…8e01d5 err="gas limit reached"
I have seen similar behavior, even with only 1000 transactions in total, or less. Everything just comes to a halt, suddenly. As I am benchmarking for TPS (and not for long term stability), I just killed everything with ./stop.sh and then restarted. But of course this is a bit worrying, hopefully you find the cause.
Just looked through my log.md:
Initially, the nodes crashed quite a few times when trying 1000 transactions,
so I started with a smaller number first:
300 transactions:
...
Perhaps our new repo https://gitlab.com/electronDLT/chainhammer helps you in any way, perhaps a simple way to trigger that problem of yours? Can you make use of that repo? Or help me with it?
Any ideas how to speed up transaction rates?
@jpmsam @mohdrashid I have seen similar behavior and I think I've found the reason. This error occurred during the leader exchange. during new leader minter a second block ,there are two block insert into blockchain which mintered by old leader ,Let's say these two blocks are block-a and block-b.In this case, function func (chain *speculativeChain) accept(acceptedBlock *types.Block) will be called twice. the first time, it will Clear speculative state,and speculatuve.head = block-a. the second time , it will call chain.removeProposedTxes(acceptedBlock),now, here , error occur,at this time speculatuve.head is block-a ,and blockchain.current = block-b. block-b.blocknumber = block-a.blocknumber + 1.then, when new leader minter a new block,there will be an error: nonce too high at any time speculatuve.head.blocknumber should >= blockchain.current.blocknumber
We're hitting this error running quorum with 3-7 nodes, and 15+tx/s. I've managed to re-created it several times, it always happens without fail, the only differing variable is the time taken. Slowing down the transaction rate seems to fix it (<5-10tx/s). The library versions are Quorum 0.7.0 from maven, which is web3j core 3.0.1. Log follows:
########## BAD BLOCK #########
Chain config: {ChainID: <nil> Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil> Byzantium: <nil> IsQuorum: true Engine: unknown}
Number: 6799
Hash: 0xa6f0ad04c89556d57638c2aa56d1a5d5fc68f2167151db00eb5e705545339cb7
Error: gas limit reached
##############################
panic: failed to extend chain: gas limit reached
goroutine 265 [running]:
panic(0xe9f2e0, 0xc42030a550)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/ethereum/go-ethereum/raft.(*ProtocolManager).applyNewChainHead(0xc420297760, 0xc420092000)
/work/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:869 +0x62a
github.com/ethereum/go-ethereum/raft.(*ProtocolManager).eventLoop(0xc420297760)
/work/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:723 +0x9f4
created by github.com/ethereum/go-ethereum/raft.(*ProtocolManager).startRaft
/work/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/raft/handler.go:482 +0x90c
There are several issues identified here and #437 should fix some of the Raft based ones. Please re-open if you've encountered something new.