logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: apache 2.4 mod_proxy lots of TIME_WAIT TCP connections
Author
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Thu 20 Nov '14 16:36    Post subject: apache 2.4 mod_proxy lots of TIME_WAIT TCP connections Reply with quote

Consider following setup:
- httpd-2.4.10-win64-VC11.zip + apache-tomcat-7.0.57-windows-x64
- windows server 2008/2012/7
- tomcat: ajp connector enabled
- apache: mod_proxy + mod_proxy_ajp enabled
- apache: simple proxy pass + proxy pass reverse directive

After each request to apache, new TCP connection to tomcat is created, ie. when refreshing page using browser, 10 new connections are created. They have TIME_WAIT status and are destroyed after 240 seconds (windows default TCP connection limit: TcpTimedWaitDelay). After lots of request in the short time, the system connection pool can be exceeded which causes apache error: OS 10055. If we decrease TcpTimedWaitDelay to 30 seconds, it's match better but the still may occur.

Another setup:
- almost same conditions, only older apache: httpd-2.2.25-win32-x86-no_ssl.msi

Apache creates one TCP connection per each proxypass directive and reuse this connection.

Do you know why it works in that way? And how to force apache 2.4 to work in the same way - or at least how to configure the connection pool to tomcat. I have tried with disablereuse, keepalaive, max, paremeters but without success.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 20 Nov '14 18:18    Post subject: Reply with quote

With 2.4 do you use any additonal parameters or just

Code:

    <Location />
        ProxyPass ajp://localhost:8009/
        ProxyPassReverse ajp://localhost:8009/
    </Location>
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Thu 20 Nov '14 21:48    Post subject: Reply with quote

Yes, it's something like:

ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Fri 21 Nov '14 14:32    Post subject: Reply with quote

I have noticed that issue occur only on windows. Linux version reuse ESTABLISHED connection.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 21 Nov '14 18:23    Post subject: Reply with quote

I have looked a bit deeper into this and it seems to be a bug in mod proxy ajp.
However you should try adjusting the KeepAlive interval (KeepAliveTimeout) on httpd and tomcat.
And or disable KeepAlive for testing on the apache side.
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 692

PostPosted: Wed 26 Nov '14 11:44    Post subject: Reply with quote

Also reported at: https://issues.apache.org/bugzilla/show_bug.cgi?id=57259
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Wed 26 Nov '14 11:45    Post subject: Reply with quote

Yes, even by me.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 08 Dec '14 18:29    Post subject: Reply with quote

Did you play with the keep Alive settings?
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Tue 09 Dec '14 9:06    Post subject: Reply with quote

Yes, without success.
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Tue 09 Dec '14 15:09    Post subject: Reply with quote

I would appreciate if someone could build and share apache for testing purpose with patch posted here:

https://issues.apache.org/bugzilla/show_bug.cgi?id=57259#c6

It should fix the problem.
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 692

PostPosted: Tue 09 Dec '14 15:21    Post subject: Reply with quote

Did you try the workaround mentioned there, not using port.
Back to top
slaklu



Joined: 06 Oct 2014
Posts: 8

PostPosted: Tue 09 Dec '14 15:50    Post subject: Reply with quote

Yes, it works. You can skip the port and use default one.

I have also tried to used not-standard port, it works as well.
Back to top


Reply to topic   Topic: apache 2.4 mod_proxy lots of TIME_WAIT TCP connections View previous topic :: View next topic
Post new topic   Forum Index -> Apache