Can't use proper-lockfile while debugging memory leaks
achingbrain opened this issue · 5 comments
I'm trying to debug memory leaks which involves generating heap dumps. This tends to peg the CPU - when it's done, the process explodes with:
/path/to/node_modules/proper-lockfile/lib/lockfile.js:181
onCompromised: (err) => { throw err; },
^
Error: Unable to update lock within the stale threshold
at options.fs.utimes (/path/to/node_modules/proper-lockfile/lib/lockfile.js:109:21)
at FSReqWrap.oncomplete (fs.js:141:20)
This is the same issue that was reported on ipfs, @hugomrdias will be doing a PR to address the issue.
How about storing the last modification time after this module updates the lock? That way when proper-lockfile
comes to updating the lock again, it can compare the current last modification time of the lockfile, and the last modification time when it updated the lock - if they are different then consider the lock stale.
This way you don't have to rely on arbitrary timeouts which are too fragile to be used when the thread is suspended (in the case above) or when there is some CPU intensive work going on (in the IPFS case).
The solution we discussed a few weeks ago was indeed similar to what you described.
It’s actually pretty easy to implement and to test. I don’t know if @hugomrdias is already on this though.
@satazor Do you maybe have a link to the ipfs issue you are referencing?
We are seeing this same error using proper-lockfile when building a nuxt project on ci's as netlify and wercker
im working to fix this problem