6

We have been working on load-testing our private blockchain network using geth and Web3j. The transactions are sent using Web3j.

We send 100 transactions, where every block has space for about 25 of them (Because of gas limit). When transactions are received on our local node, this is printed:

TRACE[07-26|10:15:53] Pooled new future transaction            hash=20453e…f2ec96 from=0x992a03b1bb4cc56929f2d21eaf34779d0562c9a7 to=0x32f1e2e74122efd01bd666750c5afc18c4ce3f91
TRACE[07-26|10:15:53] Promoting queued transaction             hash=20453e…f2ec96
INFO [07-26|10:15:53] Submitted transaction                    fullhash=0x20453ef67cba4d3549603f7a0bc0505d170a8fc2adeac849dc1a8c2fa3f2ec96 recipient=0x32f1e2e74122efd01bd666750c5afc18c4ce3f91
TRACE[07-26|10:15:53] Broadcast transaction                    hash=20453e…f2ec96 recipients=2
DEBUG[07-26|10:15:54] Transaction pool status report           executable=43 queued=0 stales=9

When all transactions are sent, our local nodes transactionpool is txpool.status:

{
  pending: 100,
  queued: 0
}  

We then start to mine on out local node.

INFO [07-26|10:20:41] Starting mining operation 
TRACE[07-26|10:20:41] Gas limit exceeded for current block     sender=0x992a03b1bb4cc56929f2d21eaf34779d0562c9a7
INFO [07-26|10:20:41] Commit new mining work                   number=8383 txs=25 uncles=0 elapsed=18.063ms
TRACE[07-26|10:20:41] Started ethash search for new nonces     miner=0 seed=4567440808604611913
DEBUG[07-26|10:20:42] Transaction pool status report           executable=100 queued=0 stales=8
TRACE[07-26|10:20:48] Ethash nonce found and reported          miner=0 attempts=313611  nonce=4567440808604925524
INFO [07-26|10:20:48] Successfully sealed new block            number=8383 hash=774d72…ba62fc
DEBUG[07-26|10:20:48] Trie cache stats after commit            misses=11 unloads=2
INFO [07-26|10:20:48] 🔗 block reached canonical chain          number=8378 hash=81b120…f0867f
INFO [07-26|10:20:48] 🔨 mined potential block                  number=8383 hash=774d72…ba62fc
TRACE[07-26|10:20:48] Transaction failed, will be removed      hash=05c537…979f0b err="invalid nonce: have 731, expected 756"
INFO [07-26|10:20:48] Commit new mining work                   number=8384 txs=0  uncles=0 elapsed=957.166µs
TRACE[07-26|10:20:48] Propagated block                         hash=774d72…ba62fc recipients=1 duration=2562047h47m16.854s
TRACE[07-26|10:20:48] Announced block                          hash=774d72…ba62fc recipients=2 duration=2562047h47m16.8

After mining one block with 25 transactions, our txpool is now empty

{
  pending: 0,
  queued: 0
}

Only 25 of the total 100 transactions were mined, and the rest were deleted (they seem to be declared as old pending transactions). My question is then. Is this the intended behavior, or are we missing something? If it is intentional, does anyone have tips for how to solve sending multiple transactions from the same address and node?

EDIT:

We created a supervisor to check for confirmed transaction, and attempt to resend the transactions if they were lost. When resending the transactions, we receive the error:

-32000 know transaction: transaction_hash

However, when manually sending eth.getTransactionReciept(transaction_hash), null is returned.

Where is known transactions stored, and why are they not mined? (They are not in txpool)

  • Are the transactions sent from the same address? If so, it maybe a nonce-related issue. – jeff Jul 26 '17 at 13:03
  • The transactions are sent from the same address, but since they all have status as pending i would think the nounces are correct? Perhaps geth chooses to mine the newest transactions, and therefore the other transactions' nounces are outdated? – Evedal Jul 26 '17 at 15:09
  • I'm seeing similar results with the following code: var arr = [] ; for (i = 1 ; i<= 110; i++){ arr.push(eth.sendTransaction({from: eth.coinbase, to: eth.accounts[1], value: web3.toWei( i/1000 + 1 , 'szabo')}))} creates 110 pending txns, but when mining is done only about 105 are mined. So eth.getTransactionReceipt(arr[100]) will give me a result, but same with arr[109] will give a null. Those missing txns are orphaned - not in txpool etc. Nonces differ. – Alan Buxton Jul 26 '17 at 16:30
  • I've been able to experience similar symptoms and catch them in the log. See this issue: github.com/ethereum/go-ethereum/issues/14893 – Alan Buxton Aug 3 '17 at 13:37
1

the result is ok. At first, i send 110 txs, the result of txpool.status

{
    pending: 110,
    queued: 0
}

and then start mined,all of transactions were mined. As follows enter image description here so the tx_pool doesn't drop any transactions. In go-ethereum source files,tx_pool.go file deal with transaction logic , some transactions will be removed if tx_pool is full that pool size over 4096+1024,the source as follows:

// If the transaction pool is full, discard underpriced transactions
if uint64(len(pool.all)) >= pool.config.GlobalSlots+pool.config.GlobalQueue {
    // If the new transaction is underpriced, don't accept it
    if pool.priced.Underpriced(tx, pool.locals) {
        log.Trace("Discarding underpriced transaction", "hash", hash, "price", tx.GasPrice())
        underpricedTxCounter.Inc(1)
        return false, ErrUnderpriced
    }
    // New transaction is better than our worse ones, make room for it
    drop := pool.priced.Discard(len(pool.all)-int(pool.config.GlobalSlots+pool.config.GlobalQueue-1), pool.locals)
    for _, tx := range drop {
        log.Trace("Discarding freshly underpriced transaction", "hash", tx.Hash(), "price", tx.GasPrice())
        underpricedTxCounter.Inc(1)
        pool.removeTx(tx.Hash())
    }
}

so there is no overflow.

  • Were all the transactions included in a single block, or did you have to mine several blocks to include them all? – Evedal Jul 31 '17 at 16:50
  • I encountered this problem when overflow 210. but i find this has relation with gasLimit, every block holds txs = gasLimit / per_tx_gas(test 21000), if there have more txs,there will be packed to next new block. So i config a big gasLimit on genesis.json file: { "config": { "chainId": 10, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "difficulty": "0x400000", "gasLimit": "2100000000000000000", "alloc": { "0xf85209fa42a3445362d82636c470b6e1e4bc7a33": { "balance": "30000000000000000000000" } } } – BinGoBinBin Aug 1 '17 at 3:24
  • and i send 10249 txs,then start mined,all transaction included a new block. because of txs too much, the result of getBlock(blockNum) will be out of screen ,so i use JSON RPC print result: curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0x5e678f610a98799edaf8664ddc988332af6301513aace6a92b65a823491afcc0"],"id":1}' localhost:8545 {"jsonrpc":"2.0","id":1,"result":"0x2809"} you will find detail logic on tx_pool.demoteUnexecutables method. – BinGoBinBin Aug 1 '17 at 3:27
1

Looks like a bug that has just been fixed: https://github.com/ethereum/go-ethereum/issues/14893

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.