You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2007/11/11 20:22:24 UTC
svn commit: r593943 - /tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
Author: rjung
Date: Sun Nov 11 11:22:23 2007
New Revision: 593943
URL: http://svn.apache.org/viewvc?rev=593943&view=rev
Log:
Undo revision 593927.
This produced a mem leak for vhosts with private JkMounts.
No idea why.
Modified:
tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=593943&r1=593942&r2=593943&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Nov 11 11:22:23 2007
@@ -2322,8 +2322,14 @@
we can't guarantee what order pools get cleaned
up between APR implementations. */
wc_close(NULL);
- if (conf->uw_map)
- uri_worker_map_free(&conf->uw_map, NULL);
+ if (conf->uri_to_context) {
+ jk_map_free(&conf->uri_to_context);
+ /* We cannot have allocated uw_map
+ * unless we've allocated uri_to_context
+ */
+ if (conf->uw_map)
+ uri_worker_map_free(&conf->uw_map, NULL);
+ }
conf->was_initialized = JK_FALSE;
}
s = s->next;
@@ -2812,7 +2818,6 @@
sconf->uri_to_context, sconf->log))
jk_error_exit(APLOG_MARK, APLOG_EMERG, srv,
srv->process->pool, "Memory error");
- jk_map_free(&sconf->uri_to_context);
if (sconf->options & JK_OPT_REJECTUNSAFE)
sconf->uw_map->reject_unsafe = 1;
else
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r593943 - /tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
Posted by Mladen Turk <mt...@apache.org>.
Rainer Jung wrote:
>
> P.S.: I hope the other changes are fine with you?
>
They look OK, but I'll double check, just in case ;)
Cheers,
Mladen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r593943 - /tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
Posted by Rainer Jung <ra...@kippdata.de>.
Mladen Turk schrieb:
> rjung@apache.org wrote:
>> Author: rjung
>> Date: Sun Nov 11 11:22:23 2007
>> New Revision: 593943
>>
>> URL: http://svn.apache.org/viewvc?rev=593943&view=rev
>> Log:
>> Undo revision 593927.
>> This produced a mem leak for vhosts with private JkMounts.
>> No idea why.
>>
>
> Because uw_map is now allocated *only* if uri_to_context is
> allocated. In other cases uw_map is pointer to the parent
> allocated uw_map. So if you free uw_map with uri_to_context equals
> NULL, you'll actually have a double free of the same pointer.
The point was not a double free (crash), but a memory leak. I freed
uri_to_context in post_config and uw_map in the cleanup. Before freeing
I actually tested both against NULL.
To find out, where th eleak comes from, I also simply didn't initialize
uw_map and still had the leak!
When I didn't initialize uri_to_context in the JkMount config handler,
the leak went away.
With only uri_to_context used and uw_map artificially commented out, I
could open/close the leak by moving the free of uri_to_context from the
cleanup (OK) to post_config (bad). That's what I don't understand.
Regards,
Rainer
P.S.: I hope the other changes are fine with you?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r593943 - /tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
Posted by Mladen Turk <mt...@apache.org>.
rjung@apache.org wrote:
> Author: rjung
> Date: Sun Nov 11 11:22:23 2007
> New Revision: 593943
>
> URL: http://svn.apache.org/viewvc?rev=593943&view=rev
> Log:
> Undo revision 593927.
> This produced a mem leak for vhosts with private JkMounts.
> No idea why.
>
Because uw_map is now allocated *only* if uri_to_context is
allocated. In other cases uw_map is pointer to the parent
allocated uw_map. So if you free uw_map with uri_to_context equals
NULL, you'll actually have a double free of the same pointer.
Regards,
Mladen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org