ap_get_module_config and RHEL5

Posted on 2008-11-12 21:18:22 EET.

This is an issue. I couldn't find why Midgard apache module refused to work on RHEL5.It just started to segfault. What's even more interesting, it started to segfault when trying to access read only data provided by apache. If you are familiar with apache modules' internals you probably know that all routines are registered as hooks. Even that ones which holds server and directory config. In normal case you register hook and get configuration later, when it's needed.

Just like this:

midgard_directory_config *dcfg = 
    (midgard_directory_config *)ap_get_module_config(r->per_dir_config, &midgard_module);

I found these two posts quite interesting. First because it affected also midgard-apache module few years ago, and the second because it clearly shows there something odd happens. Why odd? Because you never sets directory or server config explicitly. You just register function and it's up to the server implementation when it's invoked.

In my case ap_get_module_config(r->per_dir_config, &midgard_module) returned NULL all the time. So I added debug messages which showed that server and directory configuration hooks are invoked. Spent plenty of time trying to figure it out.

  1. Your hooks are working very good (the same code works with older version of Midgard)
  2. Hooks are invoked. For sure.
  3. ap_get_module_config returns NULL.

Three facts which made me think it's something wrong with Apache. Not the module itself. And after many trials and errors, I found guilty AM_CFLAG: -D_FILE_OFFSET_BITS=64. Also interesting fact, this flag is able to slow down PHP itself.

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS