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

2 Likes

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 });
};
1 Like

Maybe something wrong with node I use
node v12.18.3

1 Like

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

1 Like

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

1 Like

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

1 Like

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.