What is the cause and how to fix 503 errors with this in Apache error_log: "Broken pipe: ajp_ilink_send(): send failed"

David Resnick picture David Resnick · Oct 15, 2009 · Viewed 9.9k times · Source

I'm having intermittent problems with a servlet running on JBoss, with Apache forwarding it all requests via mod_proxy_ajp.so.

Sometimes, for REST requests, I get 503 errors from Apache. When this happens, the Apache error_log has this in it:

[Mon Oct 12 09:10:19 2009] [error] (32)Broken pipe: ajp_ilink_send(): send failed
[Mon Oct 12 09:10:19 2009] [error] (32)Broken pipe: proxy: send failed to 127.0.0.1:8009 (localhost)

After a few failed attempts, it starts working again.

I've googled some and found that I'm not the only one who has encountered the problem. The only solution I've found is to make sure that Apache is started after JBoss (I restart Apache after restarting JBoss).

The strange thing about this problem is that there are other servlets running in this JBoss and I don't have the problem there.

The servlet is CXF JAX-RS based.

Apache is 2.2.6.

Answer

skaffman picture skaffman · Oct 20, 2009

When using the AJP protocol, you have to be very careful to make sure that both sides of the communication (i.e. Apache and Tomcat) are configured with the same parameters. This is because AJP uses persistent, stateful connections, and both parties need to have the same expectations of the connection lifecycle.

I suggest giving the relevant Tomcat docs a good read. You'll probably have to modify either Apache's mod_proxy_ajp config, or Tomcat's AJP connector config, or both, so that they match. If the configs are even slightly different, AJP's performance can absolutely suck.