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

Miner deadlock in dev mode with period 0 #29656

Closed
thlucy opened this issue Apr 25, 2024 · 1 comment
Closed

Miner deadlock in dev mode with period 0 #29656

thlucy opened this issue Apr 25, 2024 · 1 comment
Labels

Comments

@thlucy
Copy link

thlucy commented Apr 25, 2024

System information

Geth version: 1.13.11, 1.13.15, 1.14.0
OS & Version: OSX

Expected behaviour

In dev mode, when the client sends transactions from two different addresses, it could be mined.

Actual behaviour

After version 1.13.11 if I send two transactions from two different addresses concurrently, the miner deadlock on txpool sync, and could not produce new blocks.

The simulated beacon API hang in the api.eth.TxPool().Sync() at this line. In the Sync(), it will trigger more new transaction events and the subscriber could not handle it, so it deadlocked. If I changed the chan size in eth/catalyst/simulated_beacon_api.go, it could allow more concurrent transactions.

  newTxs = make(chan core.NewTxsEvent, 10)

Steps to reproduce the behaviour

geth command to start in the dev mode

../build/bin/geth \
  --dev --dev.period 0 \
  --keystore $KEYSTORE \
  --http --http.addr "127.0.0.1" --http.port 8545 --http.api eth,net,web3,debug,personal,txpool \
  --rpc.txfeecap 0 \
  --verbosity 5

And the client is written by ethers.js

const ethers = require("ethers");
const provider = new ethers.JsonRpcProvider("http://localhost:8545", undefined, { cacheTimeout: -1 });

const faucet = new ethers.Wallet(`${KEY_FROM_THE_KEYSTORE}`, provider);
console.log("faucet", faucet.address);

(async () => {
  const wallets = Array(2).fill(0).map((x, i) => new ethers.Wallet(
    ethers.zeroPadBytes(`0x${(i + 132).toString(16)}`, 32), provider));

  // Sequential transactions should be fine.
  for (let w of wallets) {
    const tx = await faucet.sendTransaction({
      to: w.address,
      value: ethers.parseEther("3"),
    });
    const receipt = await tx.wait();
    console.log("init", w.address, receipt.blockNumber);
  }

  // Concurrent transactions from two different address.
  await Promise.all(wallets.map((w) => (async () => {
    for (let i = 0; i < 3; i++) {
      const tx = await w.sendTransaction({
        to: faucet.address,
        value: "1",
      });
      const receipt = await tx.wait();
      console.log(w.address, receipt.blockNumber);
    }
  })()));
})();
@jwasinger
Copy link
Contributor

duplicate of #29475.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants