Tomcat stops responding to Apache

时光毁灭记忆、已成空白 提交于 2019-11-29 13:08:46

问题


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?


回答1:


Try this :

  1. try with increase the number of thread count. (It will postpone the errors)
  2. In tomcat configuration try "org.apache.coyote.ajp.AjpProtocol" instead the APR.



回答2:


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/




回答3:


a very good explanation of the problem and how to solve it can be found at http://javaworkbench.blogspot.co.at/2013/09/apache-web-server-tomcat-ajp.html.

in short: - Configure Apache 'MaxClients' to be equal to the Tomcat AJP 'maxConnections' configuration. - Configure Tomcat AJP 'keepAliveTimeout' to close connections after a period of inactivity.




回答4:


I am using tomcat 8 with apache 2.2 and Centos, found the issue saying:

[error] ajp_read_header: ajp_ilink_receive failed
[error] (70007)The timeout specified has expired: proxy: read response failed

The solution I applied and it worked perfect:

1. Configure Apache 'MaxClients' to be equal to the Tomcat AJP 'maxConnections' configuration.
2. Configure Tomcat AJP 'keepAliveTimeout' to close connections after a period of inactivity.

Here is an example from tomcat server.xml:

<Connector port="8009" protocol="AJP/1.3" maxConnections="256" keepAliveTimeout="30000" redirectPort="8443" />

vote for answer if you liked this solution. cheers



来源:https://stackoverflow.com/questions/16394682/tomcat-stops-responding-to-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!