Comments (3)
I think this was a result of a legitimate networking timeout issue on the registry that happened around that time. Or, something else is going on.
I couldn't reproduce the problem with the package.json you provided. So, I thought, let's push it further. Like, as far as it'll go. Let's fetch every packument.
const pacote = require('../')
const https = require('https')
const fs = require('fs')
const pMap = require('p-map');
const runTest = ({rows}) => {
console.error(`Starting test with ${rows.length} packuments`)
let i = 0
pMap(rows, ({id}) => pacote.packument(id).then(result => {
if (++i % 1000 === 0)
console.error(`fetched ${i} successfully`)
}).catch(er => {
if (er.code !== 'E404') {
// 404 errors for unpublished packages are normal and expected
throw er
}
}), { concurrency: 8 }).then(() => console.log('ok!'))
}
// cache the file since it takes a long time
try {
const allDocs = JSON.parse(fs.readFileSync(__dirname + '/all_docs.json', 'utf8'))
console.error('running test with cached all_docs')
runTest(allDocs)
} catch (_) {
console.error('did not get cached all_docs', _)
https.get('https://replicate.npmjs.com/_all_docs', res => {
const body = []
res.on('data', c => body.push(c))
res.on('end', () => {
const buf = Buffer.concat(body)
fs.writeFileSync(__dirname + '/all_docs.json', buf)
runTest(JSON.parse(buf.toString()))
})
})
}
This took quite some time to finish, but it did finish successfully, downloading 1264179 packuments with a concurrency of 8.
I even bumped the concurrency up to 10,000, and it still crunched through it all without hitting a network timeout.
🤷♂️
from pacote.
@isaacs Did you try on a slow network ? Mine was 1Mbps .
And thanks for the Hard Work
from pacote.
Well, right, if you're on a slow enough network, it'll time out sometimes. The point is, it's not pacote forcing it to time out by keeping connections open for old requests when a lot of requests are made, so as far as I can tell, not a bug in this module.
If you're on a slow network, I recommend setting opts.retry which is passed through to make-fetch-happen
. If you set a very high opts.retry.retries
and opts.retry.maxTimeout
, and set a high opts.timeout
option, then you can tune it to the expected time before your network can be reasonably expected to return a result.
Since this is legitimately your network taking longer than your configs are allowing for, an ETIMEOUT is the correct error, and I think pacote and make-fetch-happen are working as designed. (Also note that it'll only hit this after retrying a few times, so transient errors shouldn't be a major problem.)
from pacote.
Related Issues (20)
- [BREAKING] remove log property
- [BUG] out of memory on npm install: fork bomb preparing from git repos if they have scripts HOT 2
- [BUG] config field gets overwritten in package.json HOT 2
- [BUG] Proxy settings appear to be ignored.
- [BUG] _cached field is incorrect
- [BUG] No possibility to embed pacote in single js file HOT 2
- Version 15.0.1 HOT 8
- [BUG] Error when extracting a directory after updating from 13.0.4 to 15.0.3 HOT 2
- [BUG] Unlimited concurrent connections are opened when using http proxy HOT 3
- [BUG] `prepack` is not called on installation of git packages HOT 3
- Reporting a vulnerability HOT 1
- [BUG] SSH retry can retry on directory created by HTTP try tried first
- [BUG] FetcherBase._tarxOptions removes files with identical inodes HOT 1
- [BUG] fullMetadata vs. local packages vs. cache
- [BUG] CDN download doesn't use provided HTTP Authorization token (even if it's provided hardcoded in the URL)
- [FEATURE] play nicer with caching
- [BUG] withTarballStream's retry can clobber a package as it is extracted. HOT 2
- [Feature] Update TAR dependency (Security Vulnerability)
- [QUESTION] pacote and npm-registry-fetch/make-fetch-happen both cache tarballs. HOT 1
- [FEATURE] reduce file extractions on disk
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pacote.