This is great, thanks, @wlad!
I've applied your change to my local 10.6 branch, built and tested it successfully. The new build now provides the correct error packet back to the client when `max_connect_errors` has been reached.
`telnet` example below:
haidong@ryzenkde:~/messAround$ telnet 192.168.1.186 3306
|
Trying 192.168.1.186...
|
Connected to 192.168.1.186.
|
Escape character is '^]'.
|
nHost '192.168.1.153' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts'Connection closed by foreign host.
|
`pymysql` example below:
haidong@ryzenkde:~/messAround$ python testConn.py
|
Traceback (most recent call last):
|
File "/home/haidong/messAround/testConn.py", line 3, in <module>
|
connection = pymysql.connect(host='192.168.1.186',
|
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 353, in __init__
|
self.connect()
|
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 632, in connect
|
self._get_server_information()
|
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 1055, in _get_server_information
|
packet = self._read_packet()
|
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet
|
packet.raise_for_error()
|
File "/usr/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
|
err.raise_mysql_exception(self._data)
|
File "/usr/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
|
raise errorclass(errno, errval)
|
pymysql.err.OperationalError: (1129, "192.168.1.153' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts'")
|
Previously with the bug, the output from `pymysql` is:
pymysql.err.InternalError: Packet sequence number wrong - got 1 expected 0
|
Similar issue is reported to PyMySQL.
https://github.com/PyMySQL/PyMySQL/issues/971
In this issue, "1130 host not allowed" error sent wrong sequence number.
Please fix this issue ASAP. Otherwise, many users will report the issue to mysql drivers and drivers maintainers need to investigate the issues.