frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Add configurable number of retries and interval between retries

Open snuyanzin opened this issue 1 year ago • 8 comments

The PR adds retry option of download and install for node, npm, yarn.

We (Flink community) sometimes faced an issue like

[ERROR] The archive file /__w/1/.m2/repository/com/github/eirslett/node/16.13.2/node-16.13.2-linux-x64.tar.gz is corrupted and will be deleted. Please try the build again.

so archive was corrupted and removed. However it would be nice to have an autoretry for this case i guess it could also partially address #882

snuyanzin avatar Jul 04 '23 19:07 snuyanzin

@eirslett can we get this bumped or merged. GitHub Actions is constantly failing with this error?

melloware avatar Oct 18 '23 13:10 melloware

Pleaaaase 😜

uebelack avatar Oct 25 '23 14:10 uebelack

I see the problem! It's just that I'm a bit unsure what the right solution is. There are trade-offs.

There are already so many configuration options on this plugin - and if you look at the PRs that have been opened, so many proposed configuration options - in the end it will just be even more unmaintainable than it already is. It's hard to write automated tests for everything without a major refactor of the codebase, and it's not uncommon that unrelated things break because of that.

Maybe adding dynamic retries is an option, I'm not sure it has to be configurable though. Could just go with a simple default, for example 3 retries, 10 seconds between each. But retrying against a CDN (nodejs.org in this case) that is overloaded usually won't fix the problem anyways, it could make the problem even worse.

There was a suggestion that we could stop streaming the downloaded file - instead just keep it in memory until it's fully downloaded. All or nothing. That will probably solve the issue with corrupt files.

As for Flink - Maybe Flink could host a mirror of the node.js CDN, for its use? This plugin has specific configuration for using other download roots. It's made specifically to be able to use a more reliable CDN than nodejs.org.

eirslett avatar Oct 25 '23 22:10 eirslett

I am going to keep my eye on 1.14.2 to see if it alleviates our GitHub Actions failures thanks for looking into this @eirslett

melloware avatar Oct 26 '23 13:10 melloware

OK getting this error now...

Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.14.2:install-node-and-npm (install node and npm) on project primefaces: 
Could not download Node.js: 
Could not download https://nodejs.org/dist/v18.8.0/node-v18.8.0-linux-x64.tar.gz: 
Premature end of Content-Length delimited message body (expected: 43,238,752; received: 11,943,636) ->

melloware avatar Oct 26 '23 14:10 melloware

OK getting this error now...

How often is this occurring - 100 % of the time, or is it only when the Node.js CDN is unstable?

eirslett avatar Oct 30 '23 15:10 eirslett

Its seems really random. So it must just be when Node.js CDN is busy?

melloware avatar Oct 30 '23 16:10 melloware

@eirslett: are there any objections against merging this? We are also facing the premature EOF issue on github actions every day and think this could help us improving it.

dennisoelkers avatar Feb 27 '24 13:02 dennisoelkers