Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat stops responding to Apache

I'm trying to resolve an issue about connecting Apache and Tomcat with mod_proxy_ajp. In my case, the Tomcat stops to response the Apache, and the apache log prints logs error message like this:

[Mon May 06 15:22:47 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Mon May 06 15:22:47 2013] [error] (120006)APR does not understand this error code: proxy: read response failed from [::1]:18009 (localhost)

I have no idea. Anyone can help me?

like image 659
sezina Avatar asked May 06 '13 08:05

sezina


1 Answers

Add connectionTimeout and keepAliveTimeout to your AJP connector found in /etc/tomcat7/server.xml.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
           connectionTimeout="10000" keepAliveTimeout="10000" />

Info about the AJP connector at https://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html

  • connectionTimeout = The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. The default value for AJP protocol connectors is -1 (i.e. infinite).

  • keepAliveTimeout = The number of milliseconds this Connector will wait for another AJP request before closing the connection. The default value is to use the value that has been set for the connectionTimeout attribute.

If connectionTimeout and keepAliveTimeout values is not defined, then AJP connections will be kept alive for infinite. Causing to many threads, default max threads is 200.

I recommend installing psi-probe - an advanced manager and monitor for Apache Tomcat, forked from Lambda Probe. https://code.google.com/p/psi-probe/

like image 93
paalfe Avatar answered Nov 15 '22 20:11

paalfe