-
Notifications
You must be signed in to change notification settings - Fork 105
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
wsconn: Ignore some connect errors. #3182
Conversation
@@ -564,7 +564,7 @@ func (conn *wsConn) Connect(ctx context.Context) (*sync.WaitGroup, error) { | |||
close(conn.readCh) // signal to MessageSource receivers that the wsConn is dead | |||
}() | |||
|
|||
return &conn.wg, err | |||
return &conn.wg, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be up to the caller to decide how to handle Connect
errors. Maybe a const error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I see now. My bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok? From the comments I think the intent was to keep going on error, we could make an exception inside the callers (dex.runner) but I don't think necessary, as all we would do is log the error again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nil
is right. Ancient bug.
@norwnd unable to request review through ui but does this fix the issue well enough? |
hey, couple things:
// Connect connects the client. Any error encountered during the initial
// connection will be returned. An auto-(re)connect goroutine will be started,
// even on error. To terminate it, use Stop() or cancel the context.
func (conn *wsConn) Connect(ctx context.Context) (*sync.WaitGroup, error) these parts ^ I'm pretty confident in, the reason I rewrote
|
The bug is not in |
I can't dig deeper right now, but could the problem be that we're using |
I must correct myself here ^ - it does fix #3180 but not in the way
edit 1: in other words, edit 2: additionally, consider how |
What you're saying makes sense, but I think the websocket is unique in that it has the option to run a retry loop. If one wanted the "correct" functionality of the connection master, they only need run the websocket with But it does solve the issue? |
Exactly. You can't return an error, because then the context is canceled, rendering the internal retry loop useless. |
|
I think
That's true for
I don't disagree with that, you are just approaching the problem from different angle (imo by fixing symptom and not the root cause). It's fine to do it like you suggest, but then it's worth revising
|
Just want to fix the issue in the simplest and most unintrusive way possible. If the ConnectionMaster needs to be reworked I think that can be a separate issue/pr. #3180 is solved with a one line change. |
Feel free to tackle any of these problems. |
All of the surrounding code suggests that we want to continue on error with initial connect unless reconnect is off. We are also already logging the error. So, do not return error for some connect failures.
closes #3180