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
Difference between lock.mtime and stat.mtime precision #82
Comments
Can you check you're using the latest version? This issue should have been resolved already. |
@alanshaw See screenshot from
|
Where are you logging |
|
Oh interesting, maybe on your system |
@satazor a simple fix to this would be to do an initial node-proper-lockfile/lib/lockfile.js Line 26 in 1a478a4
|
I dont think its my fs, its just Linux with ext4. The problem occurs always with Node v9, but in my case never with v10+ |
Another option would be to just call |
@pimlie right, but then there’s one unecessary io syscall |
@satazor Its not really unnecessary when it squashes buggy behaviour I guess (and there is no other workaround) I spent a fair amount of time trying to debug this but am afraid although I can reproduce it consistently in one of my Nuxt projects I still dont understand what causes it. Could be linux/fs behaviour, could be node. Could be related to high cpu usage or high io usage. Sorry to say I havent been able to put my finger on it yet. Any suggestions what I could do to get to the bottom of this would really be appreciated though :) |
@pimlie what I’m saying is that there’s an alternative solution that we discussed in another PR that would solve this issue while not doing any additional io syscall. You may read the suggestion in the link I gave above but @alanshaw has more context. Anyway, I will also accept a PR that does the extra syscall to resolve the bug. |
Thanks for the quick work. Can confirm the fix seems to work:
I also checked whether I still get a warning when I manually change the mtime once the lock has been created and that works too:
|
Possibly related to #79
We are still getting a lot of reports about stale locks, often on CI platforms (and docker). One possible cause might be users who are using Node <v9. It appears that in Node v9 there can be a difference in precision about the
lock.mtime
which is set with whatstat.mtime
reports back:(lines above are: <function.name> <lock.mtime> <stat.mtime>)
After the last line the lock gets compromised due to the 523ms difference
-- edit --
I removed
Node v9
from the title because actually I am not sure if this is really a Node v9 issue only. It might very well be a Node v10+ issue as well which just doesnt show as often / repeatedly due to the general (performance) improvements made in v10+The text was updated successfully, but these errors were encountered: