You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2009/12/21 13:02:54 UTC
svn commit: r892787 - in /tomcat/jk/trunk: native/common/jk_ajp_common.c
xdocs/miscellaneous/changelog.xml
Author: mturk
Date: Mon Dec 21 12:02:54 2009
New Revision: 892787
URL: http://svn.apache.org/viewvc?rev=892787&view=rev
Log:
Fix #47224 by invalidating endoint cache on address change
Modified:
tomcat/jk/trunk/native/common/jk_ajp_common.c
tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=892787&r1=892786&r2=892787&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Mon Dec 21 12:02:54 2009
@@ -1066,9 +1066,18 @@
aw->s->max_packet_size = aw->max_packet_size;
aw->s->h.sequence = aw->sequence;
if (aw->s->addr_sequence != aw->addr_sequence) {
+ unsigned int i;
aw->s->addr_sequence = aw->addr_sequence;
strncpy(aw->s->host, aw->host, JK_SHM_STR_SIZ);
aw->s->port = aw->port;
+ for (i = 0; i < aw->ep_cache_sz; i++) {
+ /* Close all connections in the cache */
+ if (aw->ep_cache[i] && IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
+ int sd = aw->ep_cache[i]->sd;
+ aw->ep_cache[i]->sd = JK_INVALID_SOCKET;
+ jk_shutdown_socket(sd, l);
+ }
+ }
}
if (locked == JK_FALSE)
jk_shm_unlock();
Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=892787&r1=892786&r2=892787&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Mon Dec 21 12:02:54 2009
@@ -44,6 +44,11 @@
<subsection name="Native">
<changelog>
<fix>
+ <bug>47224</bug>: Status: When address gets changed invalidate
+ all opened sockets in the endpoint cache. This will cause new
+ backend connections to get opened using new address. (mturk)
+ </fix>
+ <fix>
<bug>47222</bug>: Status: Add ping_timeout to the shared memory
and allow dynamic configuration. (mturk)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r892787 - in /tomcat/jk/trunk: native/common/jk_ajp_common.c
xdocs/miscellaneous/changelog.xml
Posted by Rainer Jung <ra...@kippdata.de>.
On 21.12.2009 13:02, mturk@apache.org wrote:
> Author: mturk
> Date: Mon Dec 21 12:02:54 2009
> New Revision: 892787
>
> URL: http://svn.apache.org/viewvc?rev=892787&view=rev
> Log:
> Fix #47224 by invalidating endoint cache on address change
>
> Modified:
> tomcat/jk/trunk/native/common/jk_ajp_common.c
> tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
>
> Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
> URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=892787&r1=892786&r2=892787&view=diff
> ==============================================================================
> --- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
> +++ tomcat/jk/trunk/native/common/jk_ajp_common.c Mon Dec 21 12:02:54 2009
> @@ -1066,9 +1066,18 @@
> aw->s->max_packet_size = aw->max_packet_size;
> aw->s->h.sequence = aw->sequence;
> if (aw->s->addr_sequence != aw->addr_sequence) {
> + unsigned int i;
> aw->s->addr_sequence = aw->addr_sequence;
> strncpy(aw->s->host, aw->host, JK_SHM_STR_SIZ);
> aw->s->port = aw->port;
> + for (i = 0; i< aw->ep_cache_sz; i++) {
> + /* Close all connections in the cache */
> + if (aw->ep_cache[i]&& IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
> + int sd = aw->ep_cache[i]->sd;
> + aw->ep_cache[i]->sd = JK_INVALID_SOCKET;
> + jk_shutdown_socket(sd, l);
> + }
> + }
> }
Don't we need a kind of generation counter? All connections which are
established and actually in use for requests at the moment this code
runs will not be closed and returned to the cache and reused when the
requests end.
I guess we need a generation counter in the cache that gets incremented
when we want to recycle the whole cache, and each new connection gets
the recent generation counter and when returned to the pool is gets
closed if the generation counter is to old.
Right?
This would also help in allowing to dynamicaly change more communication
parameters that are associeted to connections because we then have a
general signalling mechanism to invalidate connections which were
established with previous parameters.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org