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

code ELOCKED during compile if importing in config file #537

Closed
aerth opened this issue Mar 12, 2022 · 4 comments · Fixed by #539
Closed

code ELOCKED during compile if importing in config file #537

aerth opened this issue Mar 12, 2022 · 4 comments · Fixed by #539

Comments

@aerth
Copy link

aerth commented Mar 12, 2022

Adding the import breaks compilation. Maybe because Lots of contracts in the ./contracts directory... Tried putting on the top, or bottom of imports, same error. Removed the import, compilation works (but then script fails because it needs import)

The validations.json file starts to grow, and then the error is thrown.

I can add more info if needed. Maybe its a version mismatch somewhere.

here is the top of hardhat-config.ts

import { HardhatUserConfig, task } from "hardhat/config";
import "@openzeppelin/hardhat-upgrades"; // moved to bottom, top, same error
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";

here is the error when compiling with @openzeppelin

An unexpected error occurred:

Error: Lock file is already being held
    at /path/to/repo/node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/path/to/repo/node_modules/graceful-fs/polyfills.js:299:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/path/to/repo/cache/validations.json'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@ericglau
Copy link
Member

I was able to reproduce this issue and will look into it.

Related to #530 which is needed for Hardhat 2.9.0.

As a workaround, use Hardhat 2.8.4 for now (npm install hardhat@2.8.4).

@frangio
Copy link
Contributor

frangio commented Mar 14, 2022

Maybe because Lots of contracts in the ./contracts directory...

Yes, this is contributing high contention on this lock. How many contracts do you have?

@aerth
Copy link
Author

aerth commented Mar 15, 2022

happened at 76 contract files (hehehe) but tried starting with empty and found that around 10 it starts racing
for i in {1..30}; do echo "Try ${i}: Number of contracts: $(find ./contracts/ -type f | wc -l)"; yarn hardhat clean; yarn hardhat compile; done |& egrep 'Try|ELOCKED|Successfully'

@HenryNguyen5
Copy link

HenryNguyen5 commented Apr 12, 2023

We're still getting this error for some devs at https://github.com/smartcontractkit/chainlink

I opened #769 to address this by making the retry options configurable

@ericglau @frangio

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

Successfully merging a pull request may close this issue.

4 participants