davehodg has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to add a directive to apache's httpd.conf, straight out of the page at http://perl.apache.org/docs/2.0/user/config/custom.html#Creating_and_Using_Custom_Configuration_Directives:
package Journals::Trans; use strict; use warnings FATAL => 'all'; use Apache2::Module (); use Apache2::Directive (); my @directives = ( { name => 'JournalsTrans', }, ); Apache2::Module::add(__PACKAGE__, \@directives); sub JournalsTrans { my ($self, $parms, @args) = @_; }
Starting apache throws an exception:
Thu Sep 07 11:19:58.780223 2017 core:crit pid 15028 AH00102: Thu Sep 07 11:19:58 2017 file config.c, line 581, assertion "total_modules < conf_vector_length" failed
Any idea what caused it? Ta,

Replies are listed 'Best First'.
Re: Trying to use Apache2::Module throws an Apache exception
by hippo (Archbishop) on Sep 07, 2017 at 13:10 UTC

    How have you loaded the module and used the new directive in the Apache conf? And which version of Apache are you using?

      It's pretty stock RHEL7 running Server version: Apache/2.4.6 (). It appears that running Apache2::Module::add(__PACKAGE__, \@directives); is what triggers it. Other methods from that module are fine. Like:
      # test if an Apache module is loaded if (Apache2::Module::loaded('mod_perl.c')) { warn "mod_perl!"; }
      This is loading in a metric bumload of mod_perl 1.x code which I've brought up to date. Allegedly. I guess I ought to try the example from that page *without* all the legacy.

      Edit: I've taken out all the other code and all I'm trying to do now it load the module to add a directive to httpd.conf. The code in https://github.com/omnigroup/Apache/blob/master/httpd/server/config.c is:
      /* * If this fails some module forgot to call ap_reserve_module_ +slots*. */ ap_assert(total_modules < conf_vector_length);

        Thanks for this extra info. I'd still be interested to see those parts of the Apache configuration where you have

        1. Loaded the module
        2. Used the new directive

        If the problem is with either of those then it should be easy both to spot and to remedy.