Unable to update lock within the stale threshold

Thank you,
I have another question

truffle migrate --network kovan

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'kovan'
> Network id:      42
> Block gas limit: 12499988 (0xbebc14)


1_upgrade1.js
=============

   Deploying 'Master'
   ------------------

/Volumes/Untitled/kai/xingtu/org/contract/node_modules/graceful-fs/polyfills.js:299
        if (cb) cb.apply(this, arguments)
                   ^
Error: Unable to update lock within the stale threshold
    at /Volumes/Untitled/kai/xingtu/org/contract/node_modules/proper-lockfile/lib/lockfile.js:136:25
    at callback (/Volumes/Untitled/kai/xingtu/org/contract/node_modules/graceful-fs/polyfills.js:299:20)
    at FSReqCallback.oncomplete (fs.js:169:5)

When I deploy deployProxy

Hi @pageone,

Can you share your migration script (please don’t include any secrets)?

// migrations/NN_deploy_upgradeable_box.js
const { deployProxy } = require('@openzeppelin/truffle-upgrades');

const Master = artifacts.require('Master');

module.exports = async function (deployer) {
  await deployProxy(Master, [], { deployer });
};

Maybe something wrong with node I use
node v12.18.3

I changed many different versions,But no one works :sleepy:

I comment the err code,then success, :laughing:

@pageone See if you find a file with a .lock extension in your .openzeppelin directory, delete it and try again.

I am having this same problem

I have deleted an empty folder called 'ropsten.json.lock', but it doesn't seem to make any difference.

Here is the error:
Starting migrations...

Network name: 'ropsten'
Network id: 3
Block gas limit: 8000000 (0x7a1200)

1_deploy_contracts.js

Deploying 'Token'

transaction hash: 0x3fa8b79dde5fba669f585ffc1eb14e8cc665d7137a463a9187a185e494c7bf1e
⠴ Blocks: 1 Seconds: 12
C:...\npm\node_modules@openzeppelin\truffle-upgrades\node_modules\graceful-fs\polyfills.js:299
if (cb) cb.apply(this, arguments)
^
Error: Unable to update lock within the stale threshold
at C:...\npm\node_modules@openzeppelin\truffle-upgrades\node_modules\proper-lockfile\lib\lockfile.js:136:25
at callback (C:...\npm\node_modules@openzeppelin\truffle-upgrades\node_modules\graceful-fs\polyfills.js:299:20)
at FSReqCallback.oncomplete (fs.js:169:5)

Migration contract:
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const Token = artifacts.require("Token");

module.exports = async function(deployer) {
const instance = await deployProxy(Token, , { deployer, initializer: 'init' });
console.log('Deployed', instance.address);
};

I have been able to get around this by commenting the code that includes:

proper-lockfile/lib/lockfile.js line 136

Not sure what side effects this can have.

@redbeard Does this happen consistently every time you run it?

Can you run your migrations with DEBUG='@openzeppelin:*' in your environment? This should enable debug logging and could help identify the root of the error.

ok, where do I put that line?

I’m not sure because you seem to be running Windows. Are you using WSL?

update: I updated truffle-upgrades again and it seems to be working now.

I do think a lot of the issues stem from windows. even updating truffle-upgrades was a huge pain…I should start using WSL.

I am facing the same issue - it works ok when I deploy to ganache, but maticTestnet or bsc testnet give the same error code.

/Users/rondras/Documents/GitHub/srewoa/node_modules/graceful-fs/polyfills.js:295
        if (cb) cb.apply(this, arguments)
                   ^
Error: Unable to update lock within the stale threshold
    at /Users/rondras/Documents/GitHub/srewoa/node_modules/proper-lockfile/lib/lockfile.js:136:25
    at callback (/Users/rondras/Documents/GitHub/srewoa/node_modules/graceful-fs/polyfills.js:295:20)
    at FSReqCallback.oncomplete (fs.js:184:5)

I am using a Mac, so it cannot be a windows issue...
Thanks for any help,
rondras

Does anyone have an update about this? I'm seeing the same issue when calling "prepareUpgrade" to Goerli.

Running upgradeProxy on local test is fine.

Node & Truffle are already at the latest version (node 16.16.0 & Truffle 5.5.21, Truffle Upgrades 1.15.0

Update: I tried to deploy to Rinkeby (using Infura) and it works normally.

So I guess there is a problem with Goerli or some configurations for Goerli are not setup properly. Here's my setup for Rineky

============

rinkeby: {
       provider: () => new HDWalletProvider(mnemonic, `https://rinkeby.infura.io/v3/${infuraKey}`),
       network_id: 4,       
       gas: 5500000,        
       confirmations: 0,    // # of confirmations to wait between deployments. (default: 0)
       timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
       skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
     }

==========
And here's my setup for Goerli (using Alchemy)

goerli: {
      provider: () => new HDWalletProvider(
        mnemonic, `https://eth-goerli.alchemyapi.io/v2/${alchemyApiKey}`,
      ),
      network_id: 5,
      gasPrice: 10e9,
      skipDryRun: true,
    },

Update: after 1 successful run the migrate (deploy a proxy contract, transfer owner to a gnosis safe, prepareUpgrade a V2 implementation contract), I try to run again (using truffle migrate --reset), it fails and shows the same error

Unable to update lock within the stale threshold

Now I'm clueless. Any help pls?

This error means that the lockfile has become stale. We never see this happen, but there might be an issue with Truffle that is causing it. In this case you have to manually delete the lockfile from the file system, it is a file with a name like *.lock in the .openzeppelin directory.

I already read in another comment that I should remove the "*.lock" file, and I did that. But still the same :frowning: