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

Use native Puppet instead of the retries Gem in the CLI provider, replacing try_sleep parameter by exponential backoff #904

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Mar 4, 2019

Retries is only used by the CLI providers. Puppet itself also provides retry functionality. This avoids the need to ensure a gem is installed in the right environment, which may not even work if it's a disconnected environment.

This does ignore a parameter for the maximum time to sleep. I'm looking for feedback on how to best deal with this.

@@ -478,15 +467,15 @@

context 'network failure' do
context 'without ssh_private_key' do
CLI_NET_ERRORS.each do |error|
CLI_AUTH_ERRORS.each do |error|
it 'does not retry cli on AuthError exception' do
Copy link
Member Author

Choose a reason for hiding this comment

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

In this test I went with this description of what it was supposed to do rather than the implementation.

@dhollinger
Copy link
Member

I like it, but does it create any breaking changes?

@ekohl
Copy link
Member Author

ekohl commented Mar 4, 2019

Maybe. From a user perspective the max total sleep time is ignored and that's a change. Perhaps we should go further and actually remove the parameter from the types. That would be a breaking change, but more honest.

@vox-pupuli-tasks
Copy link

Dear @ekohl, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

@vox-pupuli-tasks
Copy link

Dear @ekohl, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

@ekohl ekohl force-pushed the remove-retries-gem branch 2 times, most recently from b815827 to f7929bd Compare August 30, 2020 19:45
Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

🙋🏻‍♀️

Puppet.debug("#{sname} caught #{exception.class.to_s.match(%r{::([^:]+)$})[1]}; retry attempt #{attempt_number}")
if attempt < cli_tries
attempt += 1
sleep(cli_try_sleep)
Copy link
Contributor

Choose a reason for hiding this comment

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

we could even try some exponential back-off here!

@@ -27,7 +27,6 @@ def self.inherited(subclass)
initvars

commands java: 'java'
confine feature: :retries
Copy link
Contributor

Choose a reason for hiding this comment

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

why is that feature now gone?
does the below function not provide that feature?

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously the feature was provided by the gem. Now it uses functionality built into Puppet itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

you mean Ruby?
retry is a Ruby keyword (that i only learned about yesterday)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I did.

@ekohl ekohl force-pushed the remove-retries-gem branch 2 times, most recently from 12a2a49 to da4283e Compare September 6, 2020 13:15
@ekohl
Copy link
Member Author

ekohl commented Sep 6, 2020

It looks like the tests are failing because something doesn't pass. With the exponential backoff I think it takes too long. Probably need to tune the 30 retries a bit.

@ekohl
Copy link
Member Author

ekohl commented Sep 6, 2020

retries seconds
0 0
1 0
2 0
3 0
4 1
5 2
6 5
7 12
8 24
9 50
10 101
11 203
12 408
13 817
14 1636
15 3275
16 6551
17 13105
18 26212
19 52426
20 104855
21 209713
22 419428
23 838858
24 1677719
25 3355440
26 6710883
27 13421770
28 26843542
29 53687088
30 107374179

I think 10 retries is a good number. 30 retries is about 3,4 years which is a bit excessive.

Edit: looks like the default is already 10. Going to tune it down to 9 and see if that's better.

@ekohl
Copy link
Member Author

ekohl commented Sep 7, 2020

It still times out where Ubuntu was previously green. I created #986 so we don't need pending anymore.

@ekohl ekohl closed this Sep 17, 2022
@ekohl ekohl deleted the remove-retries-gem branch September 17, 2022 09:18
@ekohl ekohl restored the remove-retries-gem branch September 17, 2022 09:19
@ekohl ekohl reopened this Sep 17, 2022
@ekohl ekohl mentioned this pull request Apr 23, 2024
@evgeni evgeni force-pushed the remove-retries-gem branch 3 times, most recently from 154451a to ebd0035 Compare April 24, 2024 11:35
@evgeni
Copy link
Member

evgeni commented Apr 24, 2024

I've rebased this. Still need test fixes :/

No need to fix tests if you fix the changed default value back to the default the spec tests expect.

This removes the retries gem in favor of the built in RetryAction. This
does swap the parameter cli_try_sleep for the built in exponential
backoff.

It also raises a RetriesExceeded exception instead of the
original exception. Since those aren't caught explicitly, that's not
really a huge difference. RetryAction logs at the info level which
exception has been caught.
@evgeni evgeni changed the title Remove the retries gem Use native Puppet instead of the retries Gem in the CLI provider, replacing try_sleep parameter by exponential backoff Apr 24, 2024
@evgeni evgeni marked this pull request as ready for review April 24, 2024 17:48
@evgeni evgeni merged commit 20ec96b into voxpupuli:master Apr 24, 2024
15 checks passed
@ekohl ekohl deleted the remove-retries-gem branch April 25, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants