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

Retry mechanism for sbt #450

Merged
merged 30 commits into from
Nov 28, 2023
Merged

Retry mechanism for sbt #450

merged 30 commits into from
Nov 28, 2023

Conversation

hagay3
Copy link
Contributor

@hagay3 hagay3 commented Apr 16, 2023

A retry mechanism for sbt

Resolves coursier/coursier#2733 and sbt/sbt#7200

Gradle implementation
https://docs.gradle.org/current/userguide/dependency_resolution.html#sub:http-retries

Documentation and tests will be added with more guidance

@alexarchambault @eed3si9n let me know how to proceed :)

@hagay3
Copy link
Contributor Author

hagay3 commented May 3, 2023

someone can please approve the workflow? :)
@alexarchambault @eed3si9n

@hagay3
Copy link
Contributor Author

hagay3 commented May 5, 2023

someone can please approve the workflow? :) @alexarchambault @eed3si9n

trying again ..

@hagay3 hagay3 requested a review from eed3si9n May 5, 2023 21:43
Copy link
Collaborator

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Overall LGTM

@eed3si9n
Copy link
Collaborator

eed3si9n commented May 5, 2023

Would you like to squash your commits? Otherwise, I'll squash and merge.

Copy link
Member

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

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

Sorry for blocking the merge until further discussion here, but there are a number of issues in the approach of that PR. I don’t think retrying the whole resolution whenever it failed is the right thing to do. As your link to the Gradle docs describes, Gradle only retries things for individual downloads, and only so for specific error types. Coursier already does that for some TLS-related errors, and that’s the approach that should be extended IMO (I recall several @eed3si9n’s comments going in the same direction)

@eed3si9n
Copy link
Collaborator

eed3si9n commented May 5, 2023

@alexarchambault
Copy link
Member

alexarchambault commented May 5, 2023

@hagay3 if ever you feel… too intimidated by the coursier codebase or don’t have too much time to dive into it, and really want to add that here, that might work, but the errors that trigger retries really have to be more specific. Currently, it seems any kind of error triggers a retry, which is too broad (we don’t want to retry after 404 errors for example, which is what worried me here).

I’d advice maybe to have a look at the output of a resolution that you would have liked to see retried, look for the specific exception that made it fail (like a ConnectException for example), and make only those trigger a retry here.

@hagay3
Copy link
Contributor Author

hagay3 commented May 6, 2023

@hagay3 if ever you feel… too intimidated by the coursier codebase or don’t have too much time to dive into it, and really want to add that here, that might work, but the errors that trigger retries really have to be more specific. Currently, it seems any kind of error triggers a retry, which is too broad (we don’t want to retry after 404 errors for example, which is what worried me here).

I’d advice maybe to have a look at the output of a resolution that you would have liked to see retried, look for the specific exception that made it fail (like a ConnectException for example), and make only those trigger a retry here.

Thank you for your feedback
I added a code that matches CantDownloadModule error, in addition, I'm checking if the error contains "not found" string and then deciding not to retry.
I'm wondering if we want to treat also java exceptions as the list of exceptions is quite large.

@hagay3
Copy link
Contributor Author

hagay3 commented May 6, 2023

Would you like to squash your commits? Otherwise, I'll squash and merge.

yes please squash my branch :)

@guniatais
Copy link

looks good, would love to have that!

@hagay3
Copy link
Contributor Author

hagay3 commented May 11, 2023

@alexarchambault
hi, added a code regarding specific errors to retry, wdyt?

@alexarchambault
Copy link
Member

Sorry for the delay, I'll try to find time for this in the coming days

@hagay3
Copy link
Contributor Author

hagay3 commented Jun 3, 2023

Sorry for the delay, I'll try to find time for this in the coming days

Hi, any updates regarding that?
I’ll appreciate any feedback from your side 👍🏻

@hagay3
Copy link
Contributor Author

hagay3 commented Jun 23, 2023

it's been a while since there was any update here.
is there a way to push this PR further? @alexarchambault @eed3si9n

@hagay3
Copy link
Contributor Author

hagay3 commented Jul 16, 2023

@eed3si9n @alexarchambault
bump ^

@hagay3
Copy link
Contributor Author

hagay3 commented Nov 21, 2023

@eed3si9n @alexarchambault
bump 2^

@alexarchambault
Copy link
Member

@hagay3 I rebased, tweaked many small things, and changed the way the error is detected (ensuring we retry iff a connection timeout is detected)

Should be good to merge to me, but for the last commit that I need to revert

Copy link
Member

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

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

Merging, thanks @hagay3!

@alexarchambault alexarchambault merged commit dab3f9b into coursier:main Nov 28, 2023
9 checks passed
hubertp added a commit to enso-org/enso that referenced this pull request Dec 8, 2023
Should eliminate the sporadic connection failures when downloading
dependencies. The fix that add retries has been implemented in latest
`coursier` coursier/sbt-coursier#450.
mergify bot pushed a commit to enso-org/enso that referenced this pull request Dec 8, 2023
Should eliminate the sporadic connection failures when downloading dependencies. The fix that adds retries has been implemented in latest `coursier` coursier/sbt-coursier#450.

# Important Notes
For example https://github.com/enso-org/enso/actions/runs/7132038630/job/19421764930?pr=8496
@hagay3
Copy link
Contributor Author

hagay3 commented Dec 28, 2023

Thanks @alexarchambault !
@eed3si9n
Can you refer me to the place where documentation can be added for the retry configuration?
Im just not sure how to configure the number of retries and the retry interval in build.sbt

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