Bug 43516 - mod_jk memory leak (apache reload)
mod_jk memory leak (apache reload)
Product: Tomcat Connectors
Classification: Unclassified
Component: Common
PC other
: P1 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2007-09-29 13:14 UTC by Marcel
Modified: 2008-10-05 03:10 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Marcel 2007-09-29 13:14:40 UTC
if i reload apache (graceful) the apache prozesses consumes additional 8kB for
each VirtualHost-Definition! this is independant if i define workers or not.
With 1000 VirtualHost for example, each apache process consumes on every reload
additional 8MB memory

if i remove "LoadModule jk_module modules/mod_jk.so" everything is ok again.

i have installed apache 2.0.58 and tried with mod_jk 1.2.22/23 and 25 , but all
have same problem
Comment 1 Rainer Jung 2007-09-29 13:23:38 UTC
Could you please tell us your platform?
Did you also try with httpd 2.2?
It's likely the bug doesn't depend on these details, but one never knows.

Thanks for reporting this!
Comment 2 Marcel 2007-09-29 13:53:22 UTC
no, i have not tried with apache 2.2
platform is Gentoo 4.1.2(In reply to comment #1)
Comment 3 Rainer Jung 2007-09-29 16:06:07 UTC
I could not really reproduce this. I tried with httpd 2.2 on Solaris.
I can see a memory leak after each restart, but even without mod_jk.
Could you please post your test config (OK if httpd 2.0)? Maybe you are able to
produce a "minimal" config.

How do you measure the leak? Are you looking at the memory map in the proc
filesystem entry of an httpd child process?
Comment 4 Rainer Jung 2007-09-29 16:20:28 UTC
Aha, can reproduce now. My httpd config leaks some memory even without mod_jk,
but it's only a small amount and it doesn't go up with the number of virtual

I tried again with 200 vhosts, and now I can see the mod_jk specific problem.
Comment 5 Rainer Jung 2007-09-30 06:54:30 UTC
Can you confirm, that the problem only happens, if the vhosts have no individual
JK configuration? I.e. as soon as you add an individual JkLogFile or an
individual JkMount to each host, then there is no restart leak.

If this is the case, I now know the cause of th eproblem and will think about
the right way of fixing it.
Comment 6 Marcel 2007-09-30 12:02:11 UTC
Yes! i could only make a short test, but you are right. with individual
JK configuration it seems to be ok
Comment 7 Rainer Jung 2007-09-30 16:32:03 UTC
I committed a fix. It's a little late now for me for final tests but I would
appreciate, if you could give the fix a try. I put a new tarball under


You can build this version exactly like an official release. The contents of the
tarball is the latest mod_jk code from the code repository (subversion).
Comment 8 Marcel 2007-10-01 07:40:29 UTC
Hi Rainer!
Yes, looks great! problem solved! thank you very much !
Comment 9 Rainer Jung 2007-10-01 08:25:42 UTC
... and in case you really need many virtual servers without any JK in them, you
can save some memory with the global option

JkMountCopy All

This will have the side effect, to enable all JkMounts which are defined in the
global server in the virtual servers too.

But in case you only use JK in some/few virtual servers, you can define your
JKMounts in those virtual servers and set JkMountCopy All in the global.

Then all the virtual servers that have no JkMounts will share the same config
element, saving about 8KB per virtual server.

I'm closing this issue, thanks again for reporting.
If you find a problem with the fix later, you can reopen the issue.

Fix will be part of 1.2.26, maybe sometime in November.
Comment 10 Rainer Jung 2007-11-03 11:19:24 UTC
If you have some spare cycles: we needed to apply some changes to this fix. It
would be good to know, that the updated dev snapshot found at


still is OK for you.