Project

General

Profile

Actions

Bug #1728

closed

response.c alters doc_root

Added by Anonymous over 16 years ago. Updated over 16 years ago.

Status:
Missing Feedback
Priority:
Normal
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:

Description

there is a weired thing i've encountered and while trying to see the problem in the code it fixed itself in a very weired way.

I started tracking the issue with the following debug values:


debug.log-condition-handling = "enable" 
debug.log-file-not-found = "enable" 
debug.log-request-handling = "enable" 

with only 1 worker process

here is the output that concerned me:


2008-07-21 17:22:48: (response.c.382) -- before doc_root
2008-07-21 17:22:48: (response.c.383) Doc-Root     : /home/site_images/some_name/public_html/
2008-07-21 17:22:48: (response.c.384) Rel-Path     : /engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.385) Path         :
2008-07-21 17:22:48: (configfile-glue.c.524) === start of condition block ===
2008-07-21 17:22:48: (configfile-glue.c.482) 1 (cached) result: false
2008-07-21 17:22:48: (configfile-glue.c.524) === start of condition block ===
2008-07-21 17:22:48: (configfile-glue.c.482) 2 (cached) result: false
.........
.........
.........
2008-07-21 17:22:48: (configfile-glue.c.524) === start of condition block ===
2008-07-21 17:22:48: (configfile-glue.c.482) 266 (cached) result: false
2008-07-21 17:22:48: (response.c.433) -- after doc_root
2008-07-21 17:22:48: (response.c.434) Doc-Root     : /home/site_images/
2008-07-21 17:22:48: (response.c.435) Rel-Path     : /engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.436) Path         : /home/site_images/engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.453) -- logical -> physical
2008-07-21 17:22:48: (response.c.454) Doc-Root     : /home/site_images/
2008-07-21 17:22:48: (response.c.455) Rel-Path     : /engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.456) Path         : /home/site_images/engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.473) -- handling physical path
2008-07-21 17:22:48: (response.c.474) Path         : /home/site_images/engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.530) -- file not found
2008-07-21 17:22:48: (response.c.531) Path         : /home/site_images/engine_images/logo.jpg
2008-07-21 17:22:48: (response.c.158) run condition

if you noticed


-- before doc_root
Doc-Root     : /home/site_images/some_name/public_html/

and


-- after doc_root
Doc-Root     : /home/site_images/

i had lighty 1.4.18 so i upgraded to the latest one on the site 1.4.19. same thing

so, my question was, why on earth does the doc_root change. to make things even more strange for me, the behavior that actually bothered me was random 404s. i mean, that i was pointing my browser to a certain resource and while refreshing, from time to time i was getting a 404. i figured, since the config file is pretty complex, maybe the thing processes another condition in some weired way ... i spent 2 days on that but didn't spot any issues.

so another debug idea comes to me... hey, let's check response.c see if i can miraculously spot the issue ... of course, that didn't happen :) ... but another miracle fixed it, apparently ... here is what i did:
- opened response.c and went to line 382 coressponding to the "-- before doc_root" output.
- after those logging lines and before the "-- after doc_root" ones i noticed the switch block:


switch(r = plugins_call_handle_docroot(srv, con)) {
...
}
- looking at the other lines in between the "-- before" and "--after", i figured that only plugins_call_handle_docroot could change that doc_root value
- the easiest way at that moment for me was to add logging lines and recompile see what happens.
- so i added those lines and the code looks as follows:

                if (con->conf.log_request_handling) {
                        log_error_write(srv, __FILE__, __LINE__,  "s",  "-- before doc_root");
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Doc-Root     :", con->physical.doc_root);
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Rel-Path     :", con->physical.rel_path);
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Path         :", con->physical.path);
                }
                /* the docroot plugin should set the doc_root and might also set the physical.path
                 * for us (all vhost-plugins are supposed to set the doc_root)
                 * */
                switch(r = plugins_call_handle_docroot(srv, con)) {
                case HANDLER_GO_ON:
                        break;
                case HANDLER_FINISHED:
                case HANDLER_COMEBACK:
                case HANDLER_WAIT_FOR_EVENT:
                case HANDLER_ERROR:
                        return r;
                default:
                        log_error_write(srv, __FILE__, __LINE__, "");
                        break;
                }

                if (con->conf.log_request_handling) {
                        log_error_write(srv, __FILE__, __LINE__,  "s",  "-- before -- after doc_root");
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Doc-Root     :", con->physical.doc_root);
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Rel-Path     :", con->physical.rel_path);
                        log_error_write(srv, __FILE__, __LINE__,  "sb", "Path         :", con->physical.path);
                }

                /* MacOS X and Windows can't distiguish between upper and lower-case
                 *
- i simply added the "-- before -- after doc_root" section
- configure&make&make install
- running the tests again
- pointed the browser to a resource and kept refreshing
- guess what? it never happened again ... i've refreshed for 30 minutes with multiple resources, tried everything i knew was failing... it never happened again ! it normally gave like 3-4 404s in every 10 refreshes.

doesn't make any sense but i swear this is the pure truth. so i'm thinking there is some kind of memory leak maybe threads overlapping some byte code. i have no idea.

if this makes any sense for you and you need my help with more info, i'll gladly try to provide it.

here are the important config values:


server.document-root = "/home/site_images/" 

$HTTP["host"] == "www.some_name.com" {
  server.document-root = "/home/site_images/some_name/public_html/" 
...

  $HTTP["url"] =~ "engine_javascripts" {
    server.document-root = "/home/site_images/some_name/public_html/" 
        #################
        # this is the only condition that was matching the request giving random 404s
        # a few other locations did the same thing but exactly the same pattern
        # just different engine_xxx locations
        #################
  }

...

}

-- ionut.dumitru

Actions #1

Updated by stbuehler over 16 years ago

Are you really sure you got 404s with lighttpd 1.4.19 before your own patch? There have been some fixes for the conditional cache, which would explain that.

Actions #2

Updated by Anonymous over 16 years ago

yes, i'm positive.

i did lighttpd -v, it said 1.4.18
i installed 1.4.19 and did lighttpd -v ... it said 1.4.19 ... i wanted to be sure i got it right ... then refreshed again same issues ... after the weired patch, no more issues.

if you want i can revert to default 1.4.19 and give you a link to try. but i'd prefer that to be somehow private.

let me know

Actions #3

Updated by stbuehler over 16 years ago

As you already said, only plugins_call_handle_docroot could have changed the docroot.

And as there is some conditional testing, at least one plugin was called - but there are only three modules in 1.4 which may be called: mod_evhost, mod_mysql_vhost, mod_simple_vhost.

And they overwrite the manual set server.document-root.

So perhaps you should check your config again.

Actions #4

Updated by stbuehler over 16 years ago

  • Status changed from New to Fixed
  • Resolution set to worksforme

missing feedback.

Actions #5

Updated by stbuehler over 16 years ago

  • Status changed from Fixed to Missing Feedback
Actions

Also available in: Atom