Bug 40997 - JkMountFile directive fails to update after the uri mapping file is modified
Summary: JkMountFile directive fails to update after the uri mapping file is modified
Status: RESOLVED INVALID
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: Common (show other bugs)
Version: unspecified
Hardware: Other Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-18 14:43 UTC by Gilberto
Modified: 2008-10-05 03:09 UTC (History)
0 users



Attachments
configuration files and mod_jk log (185.51 KB, application/octet-stream)
2006-11-18 14:45 UTC, Gilberto
Details
section of mod_jk.log of the section after loading module built from svn on nov 19 (194.42 KB, text/plain)
2006-11-19 20:29 UTC, Gilberto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gilberto 2006-11-18 14:43:26 UTC
Hi, I tried posting in the mail list, but the suggested solutions did not work
so I was asked to open a bug report.

I am running Geronimo+Tomcat v. 1.1.1 and I run apache v. 2.0.53. I use the
JkMountFile directive to point to a file where I instruct the server how to map
the webapps into the httpd server space.  I modify the file as I add webapps,
but the uri's are not updated.  In order to have the uri's updated I have to
restart apache httpd and then it works.

Below are the conf files I use and the log output for mod_jk.
(also available at http://www.espinozas.org/bug/JkMountFile.tar.gz)

### apache_connector.conf ###
# Load mod_jk module
# Update this path to match your modules location
<IfModule !mod_jk.c>
LoadModule    jk_module  /usr/lib/apache2/mod_jk.so
</IfModule>

# Declare the module for <IfModule directive> (remove this line on Apache 2.x)
# AddModule     mod_jk.c

# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to
access_log)
JkLogFile     /var/log/apache2/mod_jk.log

# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties
next to httpd.conf)
JkWorkersFile /etc/geronimo/workers.properties

# Set the jk log level [debug/error/info]
#JkLogLevel    debug
JkLogLevel    trace

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE, 
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format 
JkRequestLogFormat     "%w %V %T"

# To automatically load the webapps
JkAutoAlias /srv/www/geronimo/webapps
JkMountFile /etc/geronimo/uriworkermap.properties

# For Tomcat within Geronimo
JkAutoAlias /usr/share/geronimo-1.1.1/var/catalina/work/
JkAutoAlias /usr/share/geronimo-1.1.1/config-store/

# Uncomment below if JkMountFile fails
# Send everything for context /examples to worker named ajp13 (ajp13)
# URI Mappings
#JkMount /servlets-examples/  ajp13
#JkMount /jsp-examples/  ajp13

#JkMount /servlets-examples/servlet/*  ajp13
#JkMount /servlets-examples/*.jsp  ajp13
#JkMount /jsp-examples/*.jsp  ajp13
#JkMount /jsp-examples/*.jspx  ajp13
#JkMount /jsp-examples/servlet/*  ajp13

#JkUnMount /jsp-examples/*.html  ajp13
#JkUnMount /jsp-examples/*.htm  ajp13
#JkUnMount /jsp-examples/*.png  ajp13
#JkUnMount /jsp-examples/*.jpg  ajp13
#JkUnMount /jsp-examples/*.jpeg  ajp13
#JkUnMount /jsp-examples/*.gif  ajp13
#JkUnMount /jsp-examples/*.ico  ajp13

#JkUnMount /servlets-examples/*.html  ajp13
#JkUnMount /servlets-examples/*.htm  ajp13
#JkUnMount /servlets-examples/*.png  ajp13
#JkUnMount /servlets-examples/*.jpg  ajp13
#JkUnMount /servlets-examples/*.jpeg  ajp13
#JkUnMount /servlets-examples/*.gif  ajp13
#JkUnMount /servlets-examples/*.ico  ajp13

<Location "/servlets-examples/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

<Location "/jsp-examples/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

<Location "/tomcat-docs/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

### uriworkermap.properties ###
# URI Mappings

#this is how I test the auto reload
#I have a .jsp served by Geronimo/Tomcat and .html by apache httpd
#I remove the ! to serve thru geronimo/tomcat uri map
!/=ajp13
!/*=ajp13
!/*.jsp=ajp13

/servlets-examples/=ajp13
/jsp-examples/=ajp13

/servlets-examples/servlet/*=ajp13
/servlets-examples/*.jsp=ajp13
/jsp-examples/*.jsp=ajp13
/jsp-examples/*.jspx=ajp13
/jsp-examples/servlet/*=ajp13

/jsp-examples/*.html=ajp13
/jsp-examples/*.htm=ajp13
/jsp-examples/*.png=ajp13
/jsp-examples/*.jpg=ajp13
/jsp-examples/*.jpeg=ajp13
/jsp-examples/*.gif=ajp13

!/servlets-examples/*.html=ajp13
!/servlets-examples/*.htm=ajp13
!/servlets-examples/*.png=ajp13
!/servlets-examples/*.jpg=ajp13
!/servlets-examples/*.jpeg=ajp13
!/servlets-examples/*.gif=ajp13

/tomcat-docs/=ajp13
/tomcat-docs/*=ajp13
!/tomcat-docs/*.html=ajp13
!/tomcat-docs/*.htm=ajp13
!/tomcat-docs/*.png=ajp13
!/tomcat-docs/*.jpg=ajp13
!/tomcat-docs/*.jpeg=ajp13
!/tomcat-docs/*.gif=ajp13

/wiki/=ajp13
/wiki/*=ajp13

### mod_jk.log (trace level) ###
visit http://www.espinozas.org/bug/mod_jk.txt

### workers.properties ###
# running tomcat within geronimo
#workers.tomcat_home=/srv/www/geronimo-1.1.1/home

# Define 1 real worker using ajp13
worker.list=ajp13

# Set properties for ajp13 (ajp13)
worker.ajp13.type=ajp13
#worker.ajp13.host=localhost
worker.ajp13.host=frodo
worker.ajp13.port=8009
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=1
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=1
worker.ajp13.reclycle_timeout=300
Comment 1 Gilberto 2006-11-18 14:45:07 UTC
Created attachment 19140 [details]
configuration files and mod_jk log
Comment 2 Rainer Jung 2006-11-18 16:00:47 UTC
A couple of comments:

1) Your shared memory file is /srv/www/logs/jk-runtime-status. It looks like the
apache processes don't have write permissions to the file or to the directory.
If you don't like the automaticly chosen file, you can choose another one with
JkShmFile. This file is necessary.

2) Don't use worker.ajp13.cachesize=1. The directive cachesize is deprecated. It
has beend replaced by connection_pool_size. But also connection_pool_size should
only be used in very special cases. The default values are usually better.

3) cache_timeout is also deprecated. Use connection_pool_timeout instead.

4) You don't need lbfactor, since you don't use a mod_jk load balancer worker.

5) There's a typo: instead of reclycle_timeout it should by recycle_timeout, but
you shouldn't use that. It has the same meaning as connection_pool_timeout.

6) There is a couple of lines in you log:

Reloaded urimaps from /etc/geronimo/uriworkermap.properties

so actually reloading happens. To understand if there is really a problem,
please give the contents of the uriworkermap file before and after change, and
the request URL which does not work as expected after the change.
Comment 3 Rainer Jung 2006-11-18 17:59:20 UTC
Hi Gilberto,

inspired by your uriworkermap.properties, which contained "!" rules, I checked
the rule and reloading logic. In fact the behaviour when switching between
non-"!"-rules and "!"-rules was undefined at best. So adding or removing an
exclamation mark did not work.

I added a fix to svn, but tests need to wait until tomorrow. Feel free to test,
I'm interested in feedback.

Please do have a look at my previous comments 1)-6) also.
Comment 4 Gilberto 2006-11-19 20:26:18 UTC
(In reply to comment #3)
> Hi Gilberto,
> 
> inspired by your uriworkermap.properties, which contained "!" rules, I checked
> the rule and reloading logic. In fact the behaviour when switching between
> non-"!"-rules and "!"-rules was undefined at best. So adding or removing an
> exclamation mark did not work.
> 
> I added a fix to svn, but tests need to wait until tomorrow. Feel free to test,
> I'm interested in feedback.
> 
> Please do have a look at my previous comments 1)-6) also.

Hi Rainer-

I made the suggested modifications at 1)-6).  I also build the new module from
the svn and ran my one test.  It still does not work.  I will attach the
md_jk.log for the time period when I made the change of the module.  Please let
me know if there is more info I can provide to help you out.  I will to run more
tests to see if there is something goofy in my config.

Thanks for your help.
Comment 5 Gilberto 2006-11-19 20:29:49 UTC
Created attachment 19146 [details]
section of mod_jk.log of the section after loading module built from svn on nov 19
Comment 6 Rainer Jung 2006-11-20 12:20:55 UTC
Hi Gilberto,

you need to give a little info to make your tes understandable for me:

- the uriworkermap.properties before the chagne
- the same after the change
- the URL(s) with which you are testing before and after and the results of the
requests (expected/actual)
- the timestamp of the change and of the test requests

Some of that I can guess from the log, but unfortunately not all :(
Comment 7 Gilberto 2006-11-20 19:03:51 UTC
Hi Rainer-

Here is the info you requested.  Please let me know if you need more info.  I
basically just want to be able to use the "not" (!) as quick way to turn on and
off a webapp.

 - the uriworkermap.properties before the chagne:
# URI Mappings

#this is how I test the auto reload
#I have a .jsp served by Geronimo/Tomcat and .html by apache httpd
#I remove the ! to serve thru geronimo/tomcat uri map
!/bug/=ajp13
!/bug/*=ajp13
!/bug/*.txt=ajp13
!/bug/*.gz=ajp13

/*=ajp13
/*.jsp=ajp13

/servlets-examples/=ajp13
/jsp-examples/=ajp13

/servlets-examples/servlet/*=ajp13
/servlets-examples/*.jsp=ajp13
/jsp-examples/*.jsp=ajp13
/jsp-examples/*.jspx=ajp13
/jsp-examples/servlet/*=ajp13

/jsp-examples/*.html=ajp13
/jsp-examples/*.htm=ajp13
/jsp-examples/*.png=ajp13
/jsp-examples/*.jpg=ajp13
/jsp-examples/*.jpeg=ajp13
/jsp-examples/*.gif=ajp13

!/servlets-examples/*.html=ajp13
!/servlets-examples/*.htm=ajp13
!/servlets-examples/*.png=ajp13
!/servlets-examples/*.jpg=ajp13
!/servlets-examples/*.jpeg=ajp13
!/servlets-examples/*.gif=ajp13

/tomcat-docs/=ajp13
/tomcat-docs/*=ajp13
!/tomcat-docs/*.html=ajp13
!/tomcat-docs/*.htm=ajp13
!/tomcat-docs/*.png=ajp13
!/tomcat-docs/*.jpg=ajp13
!/tomcat-docs/*.jpeg=ajp13
!/tomcat-docs/*.gif=ajp13

/wiki/=ajp13
/wiki/*=ajp13


 - the same after the change
# URI Mappings

#this is how I test the auto reload
#I have a .jsp served by Geronimo/Tomcat and .html by apache httpd
#I remove the ! to serve thru geronimo/tomcat uri map
/bug/=ajp13
/bug/*=ajp13
/bug/*.txt=ajp13
/bug/*.gz=ajp13

/*=ajp13
/*.jsp=ajp13

/servlets-examples/=ajp13
/jsp-examples/=ajp13

/servlets-examples/servlet/*=ajp13
/servlets-examples/*.jsp=ajp13
/jsp-examples/*.jsp=ajp13
/jsp-examples/*.jspx=ajp13
/jsp-examples/servlet/*=ajp13

/jsp-examples/*.html=ajp13
/jsp-examples/*.htm=ajp13
/jsp-examples/*.png=ajp13
/jsp-examples/*.jpg=ajp13
/jsp-examples/*.jpeg=ajp13
/jsp-examples/*.gif=ajp13

!/servlets-examples/*.html=ajp13
!/servlets-examples/*.htm=ajp13
!/servlets-examples/*.png=ajp13
!/servlets-examples/*.jpg=ajp13
!/servlets-examples/*.jpeg=ajp13
!/servlets-examples/*.gif=ajp13

/tomcat-docs/=ajp13
/tomcat-docs/*=ajp13
!/tomcat-docs/*.html=ajp13
!/tomcat-docs/*.htm=ajp13
!/tomcat-docs/*.png=ajp13
!/tomcat-docs/*.jpg=ajp13
!/tomcat-docs/*.jpeg=ajp13
!/tomcat-docs/*.gif=ajp13

/wiki/=ajp13
/wiki/*=ajp13

 - the URL(s) with which you are testing before and after and the results of the
requests (expected/actual)
www.espinozas.org/
with the ! on, I expect to get an index.html page (white bgcolor)
with the ! off, i expect to get an index.jsp (gray bgcolor) from the webapp from
Geronimo+Tomcat

 - the timestamp of the change and of the test requests
-rw-r--r--  1 root root 1038 Nov 19 22:12 uriworkermap.properties
-rw-r--r--  1 root root 1034 Nov 20 20:23 uriworkermap.properties

### from access_log (apache) ###
208.178.101.34 - - [20/Nov/2006:08:37:02 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
212.95.252.16 - - [20/Nov/2006:10:54:37 -0600] "HEAD /icons/apache_pb.gif
HTTP/1.0" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
217.232.116.36 - - [20/Nov/2006:14:21:28 -0600] "GET /bug/JkMountFile.tar.gz
HTTP/1.1" 403 - "http://issues.apache.org/bugzilla/show_bug.cgi?id=40997"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0"
217.232.116.36 - - [20/Nov/2006:14:21:39 -0600] "GET /bug/ HTTP/1.1" 403 - "-"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0"
217.232.116.36 - - [20/Nov/2006:14:21:42 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.108.223.168 - - [20/Nov/2006:19:27:44 -0600] "GET / HTTP/1.0" 200 357 "-" "-"
66.92.134.85 - - [20/Nov/2006:20:23:29 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:21 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:23 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:25 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:26 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:29 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:30 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:32 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:33 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:35 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:36 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:38 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:39 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:40 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:24:43 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:27:45 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:27:47 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
66.92.134.85 - - [20/Nov/2006:20:27:49 -0600] "GET / HTTP/1.1" 200 357 "-"
"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"



thanks
Comment 8 Rainer Jung 2006-11-21 02:52:23 UTC
So I assume you are deleting the "!" in freont of the /bug maps to enable or
disable access to the /bug context.

The correct way is to use a minus sign "-" instead of an exclamation mark "!".

-XXX says: define a rule XXX and disable it (don't use it).
!XXX says: after you did the matching and you found a worker, go through all the
"!" rules, and if one of those matches for the same target worker, don't use the
original match, don't forward to tomcat

file change semantics without restart are: entries learnt from earlier versions
do not get deleted. The only way of manipulating old entries is adding or
removing a minus sign. Then they get disabled, or a previous disabled state is
turned into enable again.

You did:

!XXX: never use a mapping XXX. 1 rule loaded.

Change to XXX: use a mapping XXX, a second rule loaded. Now you have a rule XXX
that might match a request, but the check for exclusions afterwards still finds
the !XXX and negated the forward.

I suggest:

-XXX: Define a map XXX but disable it.

Change to XXX: Remove the disabling of XXX, ie. enable it.

If you want to be more secure, so that other rules will not be able to
accidentily map to /bug, you can also do:

!XXX
-XXX

and enable the context by changing to:

-!XXX
XXX

I'm closing this now. In case you don't understand, please proceed via the users
list. In case you are pretty sure, that there is still a bug, reopen with your
arguments.