Hi Rainer/Simon - I've just had another look at this. With no application running (IOW, all Java processes killed), I see this behaviour:

 # systemctl start apache2

This create a number of apache2 processes (generally 7). 2 new mod_jk files are created, corresponding to the apache2 process with the lowest PID

 # systemctl stop apache2

This does not remove any files (but see below)

 # systemctl restart apache2

This has the same effect as a 'start' followed by a 'stop'. A 'reload', as expected, doesn't change the PIDs and has no effect on file creation or deletion.

During testing, I did see one occasion on which the current mod_jk files were deleted. I though this might be a timeout issue, since the restart was carried out after 7 minutes, which was longer  that normal. So, I carried out 5 more tests, with the restart after 1, 2, 4, 8, and 11 minutes, and in all these cases the old files were retained and not deleted.

Maybe there's a race condition, or something distribution-specific, in the code which registers the cleanup?  I can't do much for a couple of days, at least, but I'll have a look when I get a minute.


On 19/12/2023 19:03, Rainer Jung wrote:
Hi there,

Am 19.12.23 um 18:05 schrieb EML:
Hi - I'm running mod_jk with an Apache front-end, and I'm having an issue with the JkShmFile files.

Every time Apache restarts mod_jk creates two new files (jk-runtime-status.PID and jk-runtime-status.PID.lock). These are never cleaned up; the log directory simply fills up with these files. This happens whether or not I explicitly set JkShmFile in the Apache conf.

That should no happen. There is a cleanup routine registered, which should delete the files during shutdown. And that's the behavior that I normally observe.

Is there some way I can persuade mod_jk to use a single file pair, without the PID suffix, or to delete the previous file pair on a restart? I'm not doing any load sharing.

If you must remove the PID, you can patch the code and build it yourself. The ID is added in file common/jk_shm.c in the following line:

        sprintf(jk_shmem.filename, "%s.%" JK_PID_T_FMT, fname, getpid());

You could replace it by:

        sprintf(jk_shmem.filename, "%s", fname);

If you compile the code yourself, please us the latest version 1.2.49.

As I mentioned, a normal shutdown should already remove the files. A reload should not change the pid and thereby the files. A restart in the sense of stop-then-start should also remove the old files.

I'm on Ubuntu 22.04, Apache 2.4.52. The mod_jk version is possibly 1.2.48-1.

Thanks.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to