You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Xyntrix <xy...@bitz.org> on 2009/11/06 22:39:29 UTC

[users@httpd] Multiple calls to the same function from AP_INIT_TAKEX?

Ahoy!

I am working on making some updates to a custom module for Apache that has been running fine for the past year. One of my goals is to rename a directive in my config files, but attempting to keep both the old and new directive names active.
Here's a genericized snip of the code:

static const command_rec awesome_module_cmds[] = {
        AP_INIT_TAKE1( "BlahDirective", blah_function, NULL, RSRC_CONF, "blah description"),
        AP_INIT_TAKE1( "OtherDirective", blah_function, NULL, RSRC_CONF, "blah description (OtherDirective has been deprecated, please use BlahDirective"),
        {NULL}
};

When I compile and install my module everything seems swell and the module functionally works as intended -- until graceful restarts. Intermittently httpd will segfault when I the two directives are linked to the same function during a graceful restart. When I install the new module I make sure to fully stop apache, copy the module into place, then start up Apache.  I'm using the prefork MPM with Apache 2.2.13.

Here's what I see in the error log:

[Thu Nov 05 13:07:14 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8e-fips-rhel5 mod_fastcgi/2.4.7 configured -- resuming normal operations
[Thu Nov 05 13:07:30 2009] [notice] seg fault or similar nasty error detected in the parent process

The parent httpd parent process has died at this point I end up with several orphans. I've attempted to stack trace the parent process but there's nothing useful to be gleaned from that.

I backed out all of my code changes a few lines at a time, compiled, installed -- and gracefully restarted Apache over and over in order to narrow down the root cause of these segfaults. I found when I don't have two directives calling the same function, there's no issues with graceful restarts.

I was unable to find anything in the API docs or through google that would indicate this is a problem -- am I using AP_INIT_TAKEX incorrectly here? If it's perfectly acceptable to do what I'm trying to do, I'll assume the issue is probably within my function somewhere. If it's not acceptable to use AP_INIT_TAKE1 in the way I am using it, is there a preferred way to have multiple directive names tie to the same function?

-Mike Mclane




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org