Bug #76306 tcp packet
Submitted: 13 Mar 2015 3:07 Modified: 7 May 2015 15:07
Reporter: doom12 doom Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:2.0 OS:Any
Assigned to: Peeyush Gupta CPU Architecture:Any

[13 Mar 2015 3:07] doom12 doom
Description:
2015-03-13 I report the bug, now I solved it

sometime, connector get result from mysql server and hangup becase recv() blocked

How to repeat:
...

Suggested fix:
def recv_plain(self):
        """Receive packets from the MySQL server"""
        try:
            # Read the header of the MySQL packet, 4 bytes
            packet = bytearray(b'')
            while len(packet) < 4:
                chunk = self.sock.recv(4)
                if not chunk:
                    raise errors.InterfaceError(errno=2013)
                packet += chunk

here
chunk = self.sock.recv(4)
should change to: 
chunk = self.sock.recv(1)

sometime, client read 1-3 bytes ,and loop read 4 bytes, so more than 1 read, total byes will be more than 4 bytes and after 4 bytes data will be lost. next record ,the head data will not right,and recv() block
[19 Mar 2015 13:34] Geert Vanderkelen
Thank you for the report. Yes, we had identified the problem and we will address it.
[7 May 2015 15:07] Peeyush Gupta
Fixed in v2.0.4.