server: TiDB cannot read the client's remote address in PROXY protocol header #41409
Labels
affects-6.5
affects-6.6
severity/minor
sig/sql-infra
SIG: SQL Infra
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
mysql
command connect to TiDB servershow processlist;
check the client IP and portIt will show the IP and port from Haproxy server.
2. What did you expect to see? (Required)
show processlist;
should show client IP and port that connected to Haproxy.3. What did you see instead (Required)
show processlist;
shows Haproxy server's IP and port.4. What is your TiDB version? (Required)
from TiDB 6.3.0 to master
5. Reason
From TiDB 6.3.0 it introduce the PROXY protocol lazy mode that can let proxyprotocol library can parse the PROXY protocol header when first
Read
function call. But atserver/conn.go
functionPeerHost
it will cache the connection remote address at first call. Andserver/server.go
functionstartNetworkListener
it will callPeerHost
before do the mysql protocol handshake. At that time, theconn.Read
not called anymore, so the remote address is connection's remote address not the remote address in PROXY protocol header.The text was updated successfully, but these errors were encountered: