-
Notifications
You must be signed in to change notification settings - Fork 3k
Possible lifecycle race condition #7074
Comments
Is the symptom that Could you please expand on this bug report a bit more? |
It appears to install fine, but doesn't build the native binding. If you try |
Ah excellent. I will look at that later today. (Hi from -25 edmonton btw) On Wed, Jan 7, 2015 at 9:06 AM, Stephen Belanger notifications@github.com
|
Here is a smaller repro set that produces failure for me:
fails with:
Gist of fails reproducibly OSX, Yosemite, bash npm 2.1.17, node 0.10.35 |
I can confirm that smaller repro also fails to locate bindings on Ubuntu 14.10. It currently fails on all npm 2.x versions, including next, and on both node 0.10.35 and 0.11.14. |
I'm pretty sure this is the same as #5400, and the several other referenced issues. It appears to still be an issue as of npm 2.7.4. I did some more testing and it seems to happen when a package.json depends on all of:
Simple repro:
Weirdly, the only constant seems to be shimmer. I can change to any other native module, or any other module with peerDependencies and still get the same issue. |
I have literally no idea why shimmer could be causing this failure. It has no dependencies, no lifecycle scripts, and its |
Yeah, it's super weird. I suspect it's a race condition that shimmer happens to take just long enough to install for it to surface. It may vary on other systems? |
I can reliably reproduce this in my dev environment, so it's probably not a race condition. My current guess is that it's a |
Wow. This is an entry for the WTF files:
vs
That is, the I still need to understand how that happens before I can fix it, but at least now I no longer feel like I'm losing my marbles trying to figure out which piece of npm was surreptitiously deleting stuff from the |
Oh-ho, I bet that's related to this bug: #7243 |
@iarna Maybe. The especially confounding detail I forgot to include was that you have to observe this happening in flight, because at the end of the install process / when the race is won, it's the registry's |
I think @Qard's reduction includes exactly the set of moving pieces necessary to cause this bug to manifest:
Now I get to read a bunch of debug logging output and try to figure out exactly what's happening. |
It seems every native module I try includes that same discrepancy of the lacking |
Ah! OK, that probably explains it – there's a thing in We should also probably run |
I have figured this out! 🎉 🚑 🏥Here is some log output from an instrumented build of npm. Note that lines 1-4 are npm writing Most of the time this is fine, because the several versions of There are two bugs here:
2 is more important to fix, because there's a large overhang of these weird packages (basically every package with a native binding included) in the wild. Given the complexity of doing cache invalidation properly, I'm just going to rip the whole cache out of |
It counts if I fixed it by removing the cache, right? Part of taking care of npm/npm#7074.
Yikes! That's definitely some good bugs to squash. Thanks for figuring this one out. 👍 |
A bunch of the tests are now getting more complete from / resolved information because the contents of rewritten package.json files on disk are no longer masked by `read-package-json` memoizing fs reads of package.json files. Part of fixing #7074.
I think I may have inadvertently fixed bug 1 described above when doing some unrelated changes to the caching logic a while ago, but I will verify and make sure that any changes refer to this bug. Thanks to all, especially @Qard, for their help with this. |
Epic. On Thu, Apr 2, 2015 at 8:47 PM, Forrest L Norvell
|
Bug 1 is not fixed, and fixing it will require some reasonably extensive changes to either |
As reported in IRC, I've been having issues with the install lifecycle step getting run for leveldown. The module folder is populated, but it doesn't even attempt to build the native addon. The issue was discovered on appneta/node-traceview. I've created a standalone package.json to reproduce the issue.
If I start removing deps from that the issue becomes intermittent and eventually disappears entirely if I remove enough. It seems very likely that it's caused by some sort of race condition, I'm not yet sure where.
npm version: 2.1.17, 2.1.18
node version: 0.10.35
os: Ubuntu 14.10
The text was updated successfully, but these errors were encountered: