Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
api: add DialTimeout #7617
Conversation
Yup, have done. |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit b1b5463
into
juju:2.2
Jul 11, 2017
1 check passed
github-check-merge-juju
Ran tests against PR. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details
| @@ -1125,6 +1240,10 @@ type loginTimeoutAPIAdmin struct { | ||
| } | ||
| func (a *loginTimeoutAPIAdmin) Login(req params.LoginRequest) (params.LoginResult, error) { | ||
| - <-a.r.unblock | ||
| + ch, ok := <-a.r.unblock |
jameinel
Jul 11, 2017
Owner
This is 2 cases of bare channel sends without an associated select + a tomb so that we can close the object.
Is this sane to be doing?
(I realize the original code was doing a bare receive as well.)
But its often a big red-flag for potential deadlocks if there are any bugs in other code.
axw
Jul 11, 2017
Member
It's in a test, which controls both the sender and the receiver. IMO this is fine.
|
ah, was confused about the types. IMO, I'd still like to see these turned
into:
select {
case <-time.After(testing.LongWait):
c.Fatal(blah)
case <-a.r.unblock():
}
That way when poking at the test, or if we have something go wrong you
don't end up with a deadlock and the giant panic after 10min from the test
runner.
…
|
axw
referenced this pull request
Jul 11, 2017
Merged
api: add timeout for unblocking in login test #7622
added a commit
that referenced
this pull request
Jul 11, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
axw commentedJul 11, 2017
Description of change
Add DialTimeout to api.DialOpts, and use
it in worker/apicaller instead of Timeout.
This will cause the workers to not timeout
in case of server-side rate-limiting.
QA steps
Modify apiserver/admin.go to add a Sleep(2*time.Second) before responding to Login. This emulates a highly loaded apiserver which is rate-limiting clients.
(observe no errors; there were "context deadline exceeded" errors without the DialTimeout changes)
Documentation changes
None.
Bug reference
Fixes https://bugs.launchpad.net/juju/+bug/1701438