I've got Apache 2.2.15 proxying requests to GlassFish 3.1.1 via mod_proxy_ajp using the defaults on both Apache and GlassFish. The setup seems to work okay for a very short while then I'll get a thread pool busy error message in the GlassFish log followed by a timeout error in the Apache log and the application doesn't work again until I restart GlassFish.
Should I make configuration changes to prevent this error?
Note: the system is not under heavy load - it is just accessed by myself with one browser by navigating through pages in the application. This suggests the issue might be a thread leak bug if it isn't a misconfiguration. The error I get in the browser is 500: Internal Server Error.
The error in the GlassFish log is:
SEVERE|glassfish3.1.1|org.apache.tomcat.util.threads.ThreadPool|_ThreadID=17;_ThreadName=Thread-2;|threadpool.busy
The error in the Apache log is:
[error] (70007)The timeout specified has expired: ajp_ilink_receive() can't receive header
My proxy configuration in Apache is:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyPass / ajp://mydomain:8009开发者_如何学JAVA/
ProxyPassReverse / ajp://mydomain:8009/
And in GlassFish I just run the following commands after the install:
asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server apache-proxy
asadmin set configs.config.server-config.network-config.network-listeners.network-listener.apache-proxy.jk-enabled=true
I asked this question on the GlassFish forum on java.net and got a response of the effect:
You must ensure that GlassFish's maximum threads is at least as many as Apache.
Full Answer here:
http://www.java.net/forum/topic/glassfish/glassfish/jkenabled-thread-leak
This seems like a reasonable answer so I'm posting it here for the benefit of others.
Note: one way to set the threads used on Apache is to use the max attribute like so:
ProxyPass / ajp://mydomain:8009/ max=20
精彩评论