• 1
name Punditsdkoslkdosdkoskdo

Bad Gateway 502 error with Apache mod_proxy and Tomcat

We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this:

Bad Gateway! The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET /the/

Reason: Error reading from remote server

If you think this is a server error, please contact the webmaster.

Error 502

Tomcat has plenty of threads, so it's not thread-constrained. We're pushing 2400 users via JMeter against the app. All the boxes are sitting inside our firewall on a fast unloaded network, so there shouldn't be any network problems.

Anyone have any suggestions for things to look at or try? We're heading to tcpdump next.

UPDATE 10/21/08: Still haven't figured this out. Seeing only a very small number of these under load. The answers below haven't provided any magical answers...yet. :)


So, answering my own question here. We ultimately determined that we were seeing 502 and 503 errors in the load balancer due to Tomcat threads timing out. In the short term we increased the timeout. In the longer term, we fixed the app problems that were causing the timeouts in the first place. Why Tomcat timeouts were being perceived as 502 and 503 errors at the load balancer is still a bit of a mystery.

  • 0
Reply Report