Closed
Description
Bug Report
After setting wait_timeout
to a non-zero value and then setting it back to 0, the connection will still timeout.
func (p *packetIO) readOnePacket() ([]byte, error) {
var header [4]byte
if p.readTimeout > 0 {
if err := p.bufReadConn.SetReadDeadline(time.Now().Add(p.readTimeout)); err != nil {
return nil, err
}
}
...
In this function, setting wait_timeout
to 0 won't go into SetReadDeadline
, so it doesn't take effect.
1. Minimal reproduce step (Required)
Statement stmt = conn.createStatement();
stmt.execute("set @@wait_timeout=1");
stmt.execute("set @@wait_timeout=0");
Thread.sleep(3000);
ResultSet rs = stmt.executeQuery("select 1");
2. What did you expect to see? (Required)
The query is executed successfully.
3. What did you see instead (Required)
It reports CommunicationsException
.
4. What is your TiDB version? (Required)
v3.0.17
Activity