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

Avoid infinite loop in EOF connections #1555

Merged
merged 1 commit into from
May 20, 2021
Merged

Avoid infinite loop in EOF connections #1555

merged 1 commit into from
May 20, 2021

Conversation

pchico83
Copy link
Contributor

Signed-off-by: Pablo Chico de Guzman pchico83@gmail.com

Users have reported infinite loops in this code if the error is EOF

@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #1555 (5da1d0f) into master (92b1899) will increase coverage by 0.00%.
The diff coverage is 50.00%.

❗ Current head 5da1d0f differs from pull request most recent head 14b2ece. Consider uploading reports for the commit 14b2ece to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1555   +/-   ##
=======================================
  Coverage   36.59%   36.60%           
=======================================
  Files          88       88           
  Lines        8462     8466    +4     
=======================================
+ Hits         3097     3099    +2     
- Misses       4997     4999    +2     
  Partials      368      368           
Impacted Files Coverage Δ
pkg/ssh/forward.go 71.73% <50.00%> (-0.99%) ⬇️
pkg/ssh/reverse.go 54.76% <50.00%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92b1899...14b2ece. Read the comment docs.

Copy link
Member

@rberrelleza rberrelleza left a comment

Choose a reason for hiding this comment

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

For future context: the infinite loop is by design, since we don't have a way of knowing from inside the container is there is a process to reverse forward to, we simply keep trying. This is consuming a lot of CPU, thus the ticket to wait a little bit in between retries.

@@ -77,6 +79,7 @@ func (f *forward) start(ctx context.Context) {
}

log.Infof("%s -> failed to accept connection: %v", f.String(), err)
<-tick.C
Copy link
Member

Choose a reason for hiding this comment

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

If we've only seen this on the reverse, I think we should only do it there for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Loops without a delay scare me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will reduce it to 100ms for the forward case

Copy link
Member

Choose a reason for hiding this comment

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

Ok

Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
@pchico83 pchico83 merged commit c13640e into master May 20, 2021
@pchico83 pchico83 deleted the pchico83/loop branch May 20, 2021 14:17
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.

None yet

2 participants