Server Fault Asked by user1471465 on January 4, 2021
I am running:
Apache/2.2.15 (Unix) on CentOS release 6.6 (Final)
I am running a reverse proxy that forwards requests on to a tomcat server running on localhost:8080. My config looks like this:
<VirtualHost *:80>
....
<Proxy *>
Order deny,allow
Allow from all
AuthType Basic
AuthName “Username/Password”
AuthUserFile /etc/httpd/conf.d/users.auth
Require valid-user
</Proxy>
Setenv proxy-nokeepalive 1
Setenv proxy-sendcl 1
Setenv proxy-initial-not-pooled 1
SetEnv force-proxy-request-1.0 1
ProxyPass /analytics http://localhost:8080/analytics disablereuse=on ttl=1 smax=0
ProxyPassReverse /analytics http://localhost:8080/analytics
You can see I’ve chucked a whole load of stuff in there out of desperation – I’ve been trying to get this to work for several days.
Most of the queries work fine, but it seems particularly if I don’t use the server for perhaps more than 15 minutes, when I return I get hanging, but it seems only on a POST request on the pages served from tomcat. The hang usually last 1 minute before the 502 error. Also I have seen it on GET pages but not recently, so it may be that some of the configuration changes I made changed that.
I’ve enabled debugging in the log and get:
[Sat Jan 30 21:28:49 2016] [error] [client 192.168.213.24] (70007)The timeout specified has expired: proxy: error reading status line from remote server localhost, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] mod_proxy_http.c(1414): [client 192.168.213.24] proxy: read timeout, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] mod_proxy_http.c(1465): [client 192.168.213.24] proxy: NOT Closing connection to client although reading from backend server localhost failed., referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [error] [client 192.168.213.24] proxy: Error reading from remote server returned by /analytics/msqlQuery, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] proxy_util.c(2112): proxy: HTTP: has released connection for (localhost)
When I get the hanging behaviour, I don’t see anything show up in the tomcat logs at all. I suspect that the call is never getting that far.
It’s as if Apache thinks the connection is alive, but it’s not somehow (even though I think I’ve configured it to get a fresh connection every time)
Many thanks for any assistance!
I'm glad you figured it out. When I started reading your question I was already thinking about the "session"
I have a couple of Java applications running with reverse proxy in apache and it took me awhile to get them working properly.
Answered by Nelson Amaya on January 4, 2021
EDIT: Nope, this didn't fix it. Though to be fair, the problem this time was that when I came back to it several hours later, a GET request was hanging. When I refreshed the page 6 times, it started working. I do have basic authentication on there too, however. Really not sure what's going wrong.
PREVIOUS POST WHEN I THOUGHT I'D FIXED IT: Hmm, it looks like I may have fixed it. When it was hanging, even though there was nothing in the tomcat logs, I thought I'd try stopping tomcat and see if that caused a connection error next time I tried to load the page. It did cause an error, which made me think maybe the problem was in the tomcat config.
I changed this in web.xml:
<session-config>
<session-timeout>30</session-timeout>
</session-config>
to
<session-config>
<session-timeout>1</session-timeout>
</session-config>
Perhaps tomcat was holding onto the session?
I don't really understand it yet, and not 100% sure it's fixed but it seems to be. Will post back if this is not the right answer.
Answered by user1471465 on January 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP