Skip to content

feat: retry x times if unable to find pom data #7

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

siddarthkay
Copy link

@siddarthkay siddarthkay commented Jan 19, 2024

As seen here : status-im/status-mobile#18294 and multiple times locally,
sometimes make nix-update-gradle fails to get pom data for this gradle dependency : https://plugins.gradle.org/plugin/com.adarshr.test-logger/2.0.0

Running make nix-update-gradle again fixes it, sometimes it takes more than a single retry to fix.

This PR introduces a minimum of 3 retries if go-maven-resolver fails to get pom data for any gradle dependency due to networking issues that could potentially be caused by concurrent threads.

This is just a suggestion and my not fix the problem for good, but I wanted your opinion on this @jakubgs and hence I opened this PR.

@siddarthkay siddarthkay self-assigned this Jan 19, 2024
@siddarthkay siddarthkay force-pushed the retry-pom-after-failure branch from b87c12d to a43701a Compare January 21, 2024 04:18
@siddarthkay
Copy link
Author

I at first kept retryDelay to 2 seconds and although i didn't get any error but it was taking a lot of time to run make nix-update-gradle , I manually terminated the process after it was > 30 mins.

I then updated retryDelay to half a second and get errors like this :

finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=io.netty:netty-parent:4.1.34.Final O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=org.apache.commons:commons-parent:32 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=com.sun.activation:all:1.2.0 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=io.netty:netty-parent:4.1.72.Final O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=io.netty:netty-parent:4.1.52.Final O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while 
reading body)' for: <Dep ID=com.sun.activation:all:1.2.1 O=false S= >

@siddarthkay
Copy link
Author

After keeping delay of 1 second, make nix-upgrade-gradle ran fine but took 40 minutes 🥲🥲🥲
And then later when i added one more gradle dep manually, its been failing with errors like this :

finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.apache.commons:commons-parent:52 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.apache.commons:commons-parent:33 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.apache.commons:commons-parent:39 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.apache.commons:commons-parent:48 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=net.sf.proguard:proguard-parent:5.2.1 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.codehaus.mojo:mojo-parent:34 O=false S= >
finder.go:138: error: 'context deadline exceeded (Client.Timeout or context cancellation while reading 
body)' for: <Dep ID=org.codehaus.mojo:mojo-parent:50 O=false S= >

so probably this change is not such a good idea :)

@siddarthkay
Copy link
Author

but took 40 minutes

could also be because of hotel wifi,
I'll check on another network and update here.

@siddarthkay
Copy link
Author

yeah right the 40mins was due to bad wifi, it takes 9 minutes now

Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are embedding magic constants into the finder modules. This is not how things should be done. Look at the Options struct that contains things like IgnoreOptional or RecursiveSearch. Clearly these settings should be added there as retryAttempts and retryDelayMsec to allow for configuration at runtime via CLI flags.

Secondly, why are you adding retries here if the fetcher module already has retries implemented?

func (p *Fetcher) retryFetch(url string) (io.ReadCloser, error) {
var resp http.Response
for r := 1; r <= p.retries; r++ {

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 this pull request may close these issues.

2 participants