-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
ldap: add timeout and retry-backoff for ldap (#51927) #51943
ldap: add timeout and retry-backoff for ldap (#51927) #51943
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
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.
LGTM
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release-7.1 #51943 +/- ##
================================================
Coverage ? 73.4420%
================================================
Files ? 1211
Lines ? 379785
Branches ? 0
================================================
Hits ? 278922
Misses ? 83051
Partials ? 17812 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CbcWestwolf, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
This is an automated cherry-pick of #51927
What problem does this PR solve?
Issue Number: close #51883
This PR is a smaller version of #51912. We'll finally get #51912 merged, but we need a smaller one to focus on the timeout mechanism (which is much simpler than refactor the locks).
If the LDAP connection lost after the first handshake, the LDAP goroutine and function call will hang forever.
What changed and how does it work?
I have done two modifications in this PR:
Check List
Tests
docker run --network host -it yangkeao/ldap-sasl-example:d2b324 /bin/bash
to get an environment with LDAP server. Then running a TiDB server at port 4000.Create user, setup variables, and prepare CA:
sudo cp /proc/$(pidof mysqld)/root/etc/ssl/certs/example.crt /tmp/ca.crt
Then you can login to TiDB with
yangkeao
user:Enable or disable
authentication_ldap_simple_tls
are both fine.Use the following iptables command to drop all packets to LDAP server:
Then login without TLS will timeout after 10 seconds:
Then login with TLS will timeout after 20 seconds:
This PR also fixed some tiny issues: like rebuilding the connection pool after resetting the connection related variables, to avoid having wrong connection in the pool.
Release note