Skip to content
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

Sporadic error when polling for npm package data #139

Closed
tom--pollard opened this issue Jun 15, 2021 · 6 comments · Fixed by #328
Closed

Sporadic error when polling for npm package data #139

tom--pollard opened this issue Jun 15, 2021 · 6 comments · Fixed by #328

Comments

@tom--pollard
Copy link
Contributor

tom--pollard commented Jun 15, 2021

msg="Error fetching packages" error="Polling for package @deskpro/react-content-editor returned error: context deadline exceeded (Client.Timeout or context cancellation while reading body)" feed=npm
https://registry.npmjs.org/@deskpro/react-content-editor

I've also logged it happening against https://registry.npmjs.org/@chainsafe/lodestar-utils & https://registry.npmjs.org/@duetds/css

As #123 introduced per package error handling the rest of the packages for the session as processed, in the past this would have resulted in a hard error & further data loss. The exact error isn't returned to the caller when triggered via the httpserver instead it's covered by the generic pollErr text.

@tom--pollard
Copy link
Contributor Author

tom--pollard commented Jun 15, 2021

Interestingly if I set any of the listed packages as 'critical' npm packages, the timeout error isn't returned. I've only seen the error happen on the 'firehose' when the runtime is over 10s, which highlights it could be down to the global httpClient pointer and concurrency on deferring the body closures.

@Qinusty
Copy link
Contributor

Qinusty commented Jun 16, 2021

This could potentially be caused by rate limiting on requests as npm slows the rate of replies either intentionally or simply due to the increased load.

@maxfisher-g
Copy link
Contributor

Errors in log still occurring

@calebbrown
Copy link
Contributor

I think blindly generating one goroutine per npm package is a bit naive.

Instead, the packages should be pushed to a pool of workers that limit the amount of concurrency (e.g. instead of 200 reqs all trying to happen at once, only 10 can happen simultaneously.

@calebbrown
Copy link
Contributor

The errors are largely gone with the above changes.

The remaining timeouts appear to be limited to packages with ~1000 or more versions. I suspect increasing the timeout further (e.g. 60s) will likely prevent these issues.

@maxfisher-g
Copy link
Contributor

Closing as remaining timeout issues will be dealt with by #337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants