Error 1158: Got an error reading communication packets
Error Code | SQLSTATE | Error | Description |
---|---|---|---|
1158 | 08S01 | ER_NET_READ_ERROR | Got an error reading communication packets |
Possible Causes
This error tells us that the connection between the server and client was aborted. The most common cause is that the client hard-aborted the connection, without calling mysql_close(). It could also be a problem with the connection to the server, such as a wrong or lost package.
How to Find Out More
The error log may have more information about the cause of the error. Setting the MariaDB server option log_warnings to a value of 4 or above can generate more diagnostic warnings in the error log when there is a problem reading packages:
2024-03-02 16:17:40 8 [ERROR] mariadbd: Could not read packet: fd: 52 closed: 0 alarmed: 0 remain: 4 errno: 104 vio_errno: 1158 length: -1
How to interpret the above:
errno 104
is the system error code
You can use the perror utility to get a description of it:
shell> perror 104 OS error code 104: Connection reset by peer
This means the connection was aborted by the application/user.
vio_errno: 1158
is our internal error code which stands for ER_NET_READ_ERROR "Got an error reading communication packets"
How to Fix
- Ensure you have a stable internet connection.
- Ensure that your applications calls mysql_close() for all open connections before exiting.