Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Referencing a git dependency twice with different URLs can cause a race condition in npm cache #7009

Closed
phated opened this issue Dec 25, 2014 · 3 comments
Labels
Milestone

Comments

@phated
Copy link
Contributor

phated commented Dec 25, 2014

I was referencing a dependency as ssh://git@github.com:MyOrg/MyRepo and in another place as ssh://git@github.com/MyOrg/MyRepo and it caused corruption of the package in the cache leading to install errors.

@othiym23
Copy link
Contributor

There are actually three problems in caching git dependencies that this issue highlights:

  1. These different Git URLs should normalize to the same representation inside the relevant cache code.
  2. Placing the package tarball in $HOME/.npm/package/0.0.0/package.tgz should be done atomically.
  3. There should be an inflight cache for writes to the package.tgz that disallows more than one cache write to be inflight, even without the atomic writes.

Who knows how many other weird subtleties fixing this will address.

@othiym23
Copy link
Contributor

The changes necessary to fix this issue are being landed in #7008.

@othiym23
Copy link
Contributor

Fixed by 1c48d08, 5423cf0, and 7f6557f, which do the three things, respectively, listed here. It's starting to look terrifyingly like Christmas!

@othiym23 othiym23 added this to the 2.2.0 milestone Dec 25, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants