hardhat-tracer icon indicating copy to clipboard operation
hardhat-tracer copied to clipboard

Terminal process hangs indefinitely after running tests with numerous contract calls

Open Confucian-e opened this issue 6 months ago • 3 comments

Description

When running tests using the test --v command (regardless of the number of v flags), the terminal process fails to terminate if there are numerous contract calls during the test execution. This issue persists even when attempting to close the terminal using Ctrl + C.

Steps to Reproduce

Set up a Hardhat project with multiple tests involving numerous contract calls. Run the tests using npx hardhat test --v (or --vv, --vvv, etc.). Wait for the tests to complete. Attempt to end the process or close the terminal.

Expected Behavior

The terminal process should end immediately after the tests complete or when interrupted with Ctrl + C.

Actual Behavior

The terminal process continues to run indefinitely, and Ctrl + C does not terminate it. The only way to end the process is to forcibly close the terminal window.

Environment

Operating System: MacOS Node.js version: v20.15.0

package.json

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
    "@nomicfoundation/hardhat-ethers": "^3.0.0",
    "@nomicfoundation/hardhat-ignition": "^0.15.0",
    "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
    "@nomicfoundation/hardhat-toolbox": "^5.0.0",
    "@nomicfoundation/hardhat-verify": "^2.0.0",
    "@openzeppelin/hardhat-upgrades": "^3.2.1",
    "@openzeppelin/merkle-tree": "^1.0.7",
    "@typechain/ethers-v6": "^0.5.0",
    "@typechain/hardhat": "^9.0.0",
    "@types/chai": "^4.2.0",
    "@types/mocha": ">=9.1.0",
    "@types/node": ">=18.0.0",
    "chai": "^4.2.0",
    "ethers": "^6.4.0",
    "hardhat": "^2.22.6",
    "hardhat-abi-exporter": "^2.10.1",
    "hardhat-deal": "^3.1.1",
    "hardhat-gas-reporter": "^1.0.8",
    "hardhat-tracer": "^3.1.0",
    "ohash": "^1.1.3",
    "solidity-coverage": "^0.8.0",
    "ts-node": ">=8.0.0",
    "typechain": "^8.3.0",
    "typescript": ">=4.5.0"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^5.0.2",
    "@openzeppelin/contracts-upgradeable": "^5.0.2"
  },
  "optionalDependencies": {
    "viem": "^2.18.8"
  }
}

Additional Context

This issue has been reproduced on multiple machines with different configurations. The problem seems to occur only when there are many contract calls during test execution. The issue is consistent across different levels of verbosity (-v, -vv, -vvv).

Possible Related Factors

High volume of contract calls during tests Interaction between hardhat-tracer and the test runner Potential memory leak or unhandled asynchronous operations

Any assistance in resolving this issue would be greatly appreciated. Please let me know if you need any additional information or if you'd like me to run any specific diagnostics.

Confucian-e avatar Aug 15 '24 08:08 Confucian-e