If you have Java application, there’s possibility that you may experience this exception error

org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe

Based on this JIRA and my personal experience, there are several causes why this exception occurs.

Cause 1

This exception can mean that the connection to the client browser was aborted before the response is fully transferred. It is a harmless warning as it can be due to transient network problems or the user aborts/refreshes the page before it loaded.

A list of other causes are:

  • The user closed the browser before the page loaded (this happens at specific moments during the loading of the page, more easily reproduced the slower the connection is).
  • Their Internet connection failed during loading.
  • Canceling a download (this gives a guaranteed exception).
  • They went to another page before the page loaded.
  • The browser timed the connection out before the page loaded (would have to be a large page).

Solution 1

It might be a sign of a performance problem from Java application. For example, too many Java threads application or too many connection to the database will make Java application response time slower and then load balancer or browser will be timed connection out before the page loaded.

Cause 2

When using a proxy/load balancer (like Nginx), the handling of connections being closed from the client side is handled in a less-than-graceful way, giving this exception for cases when normally it would not happen.

Solution 2

Depending on the proxy/load balancer, there might be different ways to suppress this exception. For Nginx, it has a flag to stop giving that specific exception, which has to be placed in the configuration file of the proxy proxy_ignore_client_abort on;.

For HaProxy, it has abortonclose option to enable or disable early dropping of aborted requests pending in queues. By default, abortonclose option is enabled and you don’t need change this default behaviour.