> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1100-to-1199/e1160.md).

# Error 1160: Got an error writing communication packets

| Error Code | SQLSTATE | Error                     | Description                                |
| ---------- | -------- | ------------------------- | ------------------------------------------ |
| 1160       | 08S01    | ER\_NET\_ERROR\_ON\_WRITE | Got an error writing communication packets |

## Possible Causes and Solutions

The server couldn't send data to the client, because the connection was already closed or broken. Usually the client went away while the server was still sending a result, for example:

* The application or client was killed, crashed, or exited without closing the connection.
* The application stopped reading a large result and closed the connection.
* A firewall, load balancer or proxy between client and server dropped the connection.

The client doesn't see this error, because it's no longer connected. The server ends the connection, counts it in the [Aborted\_clients](/docs/server/server-management/variables-and-modes/server-status-variables.md#aborted_clients) status variable, and, when [log\_warnings](/docs/server/server-management/variables-and-modes/server-system-variables.md#log_warnings) is greater than 1 (the default is 2), writes a warning to the [error log](/docs/server/server-management/server-monitoring-logs/error-log.md):

```
[Warning] Aborted connection 24 to db: 'shop' user: 'root' host: 'localhost' (Got an error writing communication packets)
```

With `log_warnings` set to 4 or more, the server also logs the failed write:

```
[Warning] Could not write packet: fd: 51  state: 1  errno: 32  vio_errno: 1160  length: 16384
[ERROR] mariadbd: Got an error writing communication packets
[Warning] Aborted connection 22 to db: 'shop' user: 'root' host: 'localhost' (Got an error writing communication packets)
```

In the `Could not write packet` line, `22` and `24` are connection IDs, `errno` is the operating system error, and `length` is the number of bytes the server tried to send. Use [perror](/docs/server/clients-and-utilities/administrative-tools/perror.md) to look up the operating system error:

```
shell> perror 32
OS error code  32:  Broken pipe
```

`Broken pipe` and `Connection reset by peer` mean that the other side closed the connection.

To solve the error:

* Find out how the application ends its connections. It should read results completely, or close the connection explicitly, before it exits.
* If the connections go through a proxy, load balancer or firewall, check its idle and session timeouts, and its logs.
* If only a few connections are affected, and the applications work, the messages are harmless. You can then lower `log_warnings` to 1 to stop logging them.

When a write times out instead, after [net\_write\_timeout](/docs/server/server-management/variables-and-modes/server-system-variables.md#net_write_timeout) seconds, the server reports [error 1161](/docs/server/reference/error-codes/mariadb-error-codes-1100-to-1199/e1161.md) (`Got timeout writing communication packets`). Errors reading from the client are [error 1158](/docs/server/reference/error-codes/mariadb-error-codes-1100-to-1199/e1158.md).

## See Also

* [perror](/docs/server/clients-and-utilities/administrative-tools/perror.md) Getting a description for an error number.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
