-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix client backoff #537
base: master
Are you sure you want to change the base?
Fix client backoff #537
Conversation
That’s strange, chisel client should retry forever…
…On Fri, 25 Oct 2024 at 3:55 AM Dylan Evans ***@***.***> wrote:
The code here
<https://github.com/jpillora/chisel/blob/ab8f06a83048dca0c24dc0b06932dc98df54e8b1/client/client_connect.go#L22C1-L22C55>
fails to set a minimum value for the backoff based on this
<https://github.com/jpillora/backoff> project.
image.png (view on web)
<https://github.com/user-attachments/assets/36f8c2cf-3dbc-4b07-9126-ec61cfdb37f7>
This means if the server is down, the backoff minimum for every chisel
user is set to a 100ms value by default according to the screenshot above
and will result in extremely short backoffs (default behavior is shown
below).
image.png (view on web)
<https://github.com/user-attachments/assets/953b22cc-3f60-440a-b6a6-25c0eba6b60c>
Specifically, the sequence will always be 100ms, 200ms, 400ms, 800ms, and
1.6s (if the server is down). This technically gives the user about 2
seconds to get the server back up before the client exits entirely, and it
is noisy over the wire to send this many packets this fast. I hope you can
see how this can be problematic based on use case. The updated behavior
with this commit can be seen below and gives users more time to get the
server back up and running:
image.png (view on web)
<https://github.com/user-attachments/assets/e555a341-765e-4078-b472-7c375db2c57f>
------------------------------
You can view, comment on, or merge this pull request online at:
#537
Commit Summary
- 4ee133c
<4ee133c>
Fix client backoff
File Changes
(3 files <https://github.com/jpillora/chisel/pull/537/files>)
- *M* client/client.go
<https://github.com/jpillora/chisel/pull/537/files#diff-bd3a55a72186f59e2e63efb4951573b2f9e4a7cc98086e922b0859f8ccc1dd09>
(4)
- *M* client/client_connect.go
<https://github.com/jpillora/chisel/pull/537/files#diff-b81c2753c2377ac47f62677fba0bea2b7e11d810389b94eb99310d65077e10c3>
(2)
- *M* main.go
<https://github.com/jpillora/chisel/pull/537/files#diff-2873f79a86c0d8b3335cd7731b0ecf7dd4301eb19a82ef7a1cba7589b5252261>
(4)
Patch Links:
- https://github.com/jpillora/chisel/pull/537.patch
- https://github.com/jpillora/chisel/pull/537.diff
—
Reply to this email directly, view it on GitHub
<#537>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE2X46MWG3Y3YKF5JPCFC3Z5ERB7AVCNFSM6AAAAABQRQXWTKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTEMJRGY4DSMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Respectfully, I never said retrying was the issue or that the client would stop retrying unintentionally... the title of the PR is You always set After fix (and You can do your own testing to verify what I am reporting. Start a server, connect a client, kill the server with the client still connected and you'll see the first 5 backoffs will always be 100ms, 200ms, 400ms, 800ms, 1.6s, etc. with no ability to customize. I would classify this as a bug due to the unintentional nature of this behavior. You don't document this anywhere and I'm pretty sure a lot of people are unaware unless they take a look at the code surrounding the backoff logic. If you don't plan on fixing, you should document it is a known issue so people at least have the heads up. The logic might work for a development branch or testing, but when it comes to production version of the code, the user should be able to customize this behavior relating to the backoff. |
If not exposed as a client flag, I believe enabling Jitter by default would be a good thing as well: |
I'll add this to another commit @liojacqs soon 😄 |
The code here fails to set a minimum value for the backoff based on this project.
This means if the server is down, the backoff minimum for every chisel user is set to a 100ms value by default according to the screenshot above and will result in extremely short backoffs (default behavior is shown below).
Specifically, the sequence will always be 100ms, 200ms, 400ms, 800ms, and 1.6s (if the server is down). This technically gives the user about 2 seconds to get the server back up before the client exits entirely, and it is noisy over the wire to send this many packets this fast. I hope you can see how this can be problematic based on use case. The updated behavior with this commit can be seen below and gives users more time to get the server back up and running: