Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with an Apache in front of Tomcat using AJP connector and mod_proxy

I've a Apache Server (Server version: Apache/2.2.22 (Ubuntu)) in front of a set of three tomcat6 servers. Apache is set up as a load balancer using mod_proxy and the AJP connector:

<VirtualHost *:80>
    ProxyRequests off        
<Proxy balancer://mycluster>
    BalancerMember ajp://localhost:8009 keepalive=On retry=1 timeout=15 ping=1
    BalancerMember ajp://10.0.3.152:8009 keepalive=On retry=1 timeout=15 ping=1
    BalancerMember ajp://10.0.3.153:8009 keepalive=On retry=1 timeout=1 ping=15

    Order Deny,Allow
    Deny from none
    Allow from all
    ProxySet lbmethod=byrequests
</Proxy>

    <Location /balancer-manager>
            SetHandler balancer-manager 
            Order deny,allow
            Allow from all
    </Location>

    ProxyPass /balancer-manager !
    ProxyPass / balancer://mycluster/
</VirtualHost>

Tomcat is running with the following JAVA_OPTS:

-Xms2048m -Xmx2048m -XX:NewSize=256m 
-XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m

The system works fine, however after a while I receive these errors from Tomcat:

org.apache.jk.common.ChannelSocket processConnection 
WARNING: processCallbacks status 2

And this one from Apache:

[error] ajp_read_header: ajp_ilink_receive failed
[error] (70007)The timeout specified has expired: proxy: read response failed from  127.0.0.1:8009 (localhost)
[error] (70007)The timeout specified has expired: ajp_ilink_receive() can't receive header

I have to restart Tomcat to make it works again.

Any idea about what's happening??? After googling for a while it seems that this's a pretty common issue, however I didn't find a proper solution.

Thanks for your help!

like image 534
Curro Avatar asked Nov 13 '22 04:11

Curro


1 Answers

Depends a bit what the situation is - a very common cause is harmless; see:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200905.mbox/%3C6B028542C4A77D4CB7F06CCC1C1AEB1D018BC5CEE0@AUSP01VMBX03.collaborationhost.net%3E

i.e. apache closing out as the client (browser) has closed the TCP connection and that all having propagated through before tomcat has sent its reply down the internal TCP socket.

So I'd up the log level to confirm it - and then scale it down appropriately for production.

like image 184
Dirk-Willem van Gulik Avatar answered Nov 14 '22 23:11

Dirk-Willem van Gulik