You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Anthony Hinsinger <an...@univ-metz.fr> on 2004/05/08 12:59:19 UTC

Apache custom directives problem

Hello,

i'm currently writing a mod_perl authentification handler, and i want to 
add apache custom directives. I followed techniques explained in the 
mod_perl cookbook (http://www.modperlcookbook.org/chapters/ch07.pdf) 
using Apache::Extutils::command_table() to add 2 directives 
(req_override set to OR_AUTHCFG).

I use PerlModule into main httpd.conf to load my module, and i can 
successfully see it as a "C" module defining two directives with mod_info.

But i've a problem :
if i define directives into httpd.conf (in <Directory> or <Location> 
blocks) no problem, it works perfectly and i can retrieve directives 
values using Apache::ModuleConfig->get($r, __PACKAGE__);
But if i define directives in a .htaccess file, apache crash with this 
log added for each request :

[Mon May  3 16:12:39 2004] [notice] child pid 31813 exit signal 
Segmentation fault (11)

I don't know when apache crash exactly, because for example my 
authentification handler works, and i retrieve directives values. I 
think it crash when it send content.

Does anyone has an idea ?
is it a bug ?
is it a mistake ?


Thanks !

Anthony Hinsinger
Univerity of Metz
France

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Glenn <gs...@gluelogic.com>.
On Mon, May 10, 2004 at 02:55:34PM -0700, Stas Bekman wrote:
> Anthony Hinsinger wrote:
> >This is my xs file. it's 100% generated by Apache::Extutils.
> 
> >static mod_perl_perl_dir_config *newPerlConfig(pool *p)
> >{
> >    mod_perl_perl_dir_config *cld =
> >        (mod_perl_perl_dir_config *)
> >            palloc(p, sizeof (mod_perl_perl_dir_config));
> >    cld->obj = Nullsv;
> 
> so unless something else modifies that member, data->obj should be NULL 
> (Nullsv is (SV*)NULL). It has been ages since I've messed up with that if 
> at all. Perhaps someone who has built directives extensions can help you 
> here. Or compare this autogenerated XS with some other module that creates 
> similar extensions. I think there are a few of them on CPAN. Geoffrey's book
> http://www.modperlcookbook.org/ shouldn't have some tar balls with working 
> examples. Try to build them first.
> 
> If nothing else works, try to step through with gdb/ddd breaking at 
> newPerlConfig and following from there.

How do you compile the XS module?
Are you using the same flags that were used to compile perl and
mod_perl and Apache?  Flags related to pointer sizes and large file
support (e.g. 32-bit or 64-bit off_t) must match between them all.

See the following
http://marc.theaimsgroup.com/?l=apache-modperl&m=108210589813501&w=2

Check the address of &data->obj at different points in the call stack.

Cheers,
Glenn

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> This is my xs file. it's 100% generated by Apache::Extutils.

> static mod_perl_perl_dir_config *newPerlConfig(pool *p)
> {
>     mod_perl_perl_dir_config *cld =
>         (mod_perl_perl_dir_config *)
>             palloc(p, sizeof (mod_perl_perl_dir_config));
>     cld->obj = Nullsv;

so unless something else modifies that member, data->obj should be NULL 
(Nullsv is (SV*)NULL). It has been ages since I've messed up with that if at 
all. Perhaps someone who has built directives extensions can help you here. Or 
compare this autogenerated XS with some other module that creates similar 
extensions. I think there are a few of them on CPAN. Geoffrey's book
http://www.modperlcookbook.org/ shouldn't have some tar balls with working 
examples. Try to build them first.

If nothing else works, try to step through with gdb/ddd breaking at 
newPerlConfig and following from there.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
This is my xs file. it's 100% generated by Apache::Extutils.

Anthony

--- quote ----

#include "modules/perl/mod_perl.h"

static mod_perl_perl_dir_config *newPerlConfig(pool *p)
{
     mod_perl_perl_dir_config *cld =
         (mod_perl_perl_dir_config *)
             palloc(p, sizeof (mod_perl_perl_dir_config));
     cld->obj = Nullsv;
     cld->pclass = "Apache::AuthCAS";
     register_cleanup(p, cld, perl_perl_cmd_cleanup, null_cleanup);
     return cld;
}

static void *create_dir_config_sv (pool *p, char *dirname)
{
     return newPerlConfig(p);
}

static void *create_srv_config_sv (pool *p, server_rec *s)
{
     return newPerlConfig(p);
}

static void stash_mod_pointer (char *class, void *ptr)
{
     SV *sv = newSV(0);
     sv_setref_pv(sv, NULL, (void*)ptr);
     hv_store(perl_get_hv("Apache::XS_ModuleConfig",TRUE),
              class, strlen(class), sv, FALSE);
}

static mod_perl_cmd_info cmd_info_CASServerName = {
"Apache::AuthCAS::CASServerName", "",
};
static mod_perl_cmd_info cmd_info_CASServerPath = {
"Apache::AuthCAS::CASServerPath", "",
};
static mod_perl_cmd_info cmd_info_CASServerPort = {
"Apache::AuthCAS::CASServerPort", "",
};
static mod_perl_cmd_info cmd_info_CASCaFile = {
"Apache::AuthCAS::CASCaFile", "",
};


static command_rec mod_cmds[] = {

     { "CASServerName", perl_cmd_perl_TAKE1,
       (void*)&cmd_info_CASServerName,
       OR_AUTHCFG, TAKE1, "URL of the CAS server" },

     { "CASServerPath", perl_cmd_perl_TAKE1,
       (void*)&cmd_info_CASServerPath,
       OR_AUTHCFG, TAKE1, "Path on CAS on the server (default is /)" },

     { "CASServerPort", perl_cmd_perl_TAKE1,
       (void*)&cmd_info_CASServerPort,
       OR_AUTHCFG, TAKE1, "Port the CAS server is listenning on (default 
is 443)" },

     { "CASCaFile", perl_cmd_perl_TAKE1,
       (void*)&cmd_info_CASCaFile,
       OR_AUTHCFG, TAKE1, "Location of the CAS server public key" },

     { NULL }
};

module MODULE_VAR_EXPORT XS_Apache__AuthCAS = {
     STANDARD_MODULE_STUFF,
     NULL,               /* module initializer */
     create_dir_config_sv,  /* per-directory config creator */
     NULL,   /* dir config merger */
     create_srv_config_sv,       /* server config creator */
     NULL,        /* server config merger */
     mod_cmds,               /* command table */
     NULL,           /* [7] list of handlers */
     NULL,  /* [2] filename-to-URI translation */
     NULL,      /* [5] check/validate user_id */
     NULL,       /* [6] check user_id is valid *here* */
     NULL,     /* [4] check access by host address */
     NULL,       /* [7] MIME type checker/setter */
     NULL,        /* [8] fixups */
     NULL,             /* [10] logger */
     NULL,      /* [3] header parser */
     NULL,         /* process initializer */
     NULL,         /* process exit/cleanup */
     NULL,   /* [1] post read_request handling */
};

#define this_module "Apache/AuthCAS.pm"

static void remove_module_cleanup(void *data)
{
     if (find_linked_module("Apache::AuthCAS")) {
         /* need to remove the module so module index is reset */
         remove_module(&XS_Apache__AuthCAS);
     }
     if (data) {
         /* make sure BOOT section is re-run on restarts */
         (void)hv_delete(GvHV(incgv), this_module,
                         strlen(this_module), G_DISCARD);
          if (dowarn) {
              /* avoid subroutine redefined warnings */
              perl_clear_symtab(gv_stashpv("Apache::AuthCAS", FALSE));
          }
     }
}

MODULE = Apache::AuthCAS                PACKAGE = Apache::AuthCAS

PROTOTYPES: DISABLE

BOOT:
     XS_Apache__AuthCAS.name = "Apache::AuthCAS";
     add_module(&XS_Apache__AuthCAS);
     stash_mod_pointer("Apache::AuthCAS", &XS_Apache__AuthCAS);
     register_cleanup(perl_get_startup_pool(), (void *)1,
                      remove_module_cleanup, null_cleanup);

void
END()

     CODE:
     remove_module_cleanup(NULL);

---- quote ----


Stas Bekman wrote:

> Anthony Hinsinger wrote:
> 
>> i restarted a gdb session so *sv has changed (backtrace is exactly the 
>> same as in previous post)
> 
> 
> That's normal.
> 
>> (gdb) p *sv
>> $2 = (SV *) 0x2d656863
>> (gdb) p **sv
>> Cannot access memory at address 0x2d656863
>> (gdb)
> 
> 
> So *sv is bogus. That means that data->obj is bogus in:
> 
> #2  0x0807c99b in perl_cmd_perl_TAKE1 (cmd=0xbffffa10, data=0xbffffa10,
>     one=0xbffffa10 "à»\001@\037") at perl_config.c:859
> 
> invoked by
> 
> #3  0x080b9fe9 in invoke_cmd (cmd=0x4001bc80, parms=0xbffffa10,
>     mconfig=0x888fdb4, args=0xbfffd9e3 "") at http_config.c:828
> 
> You can test, by going to frame #2
> 
> gdb> up
> gdb> up
> gdb> p data->obj
> gdb> p *data->obj
> 
> So most likely something is wrong with your XS code that creates the new 
> directive. Show us the XS code.
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:

> i restarted a gdb session so *sv has changed (backtrace is exactly the 
> same as in previous post)

That's normal.

> (gdb) p *sv
> $2 = (SV *) 0x2d656863
> (gdb) p **sv
> Cannot access memory at address 0x2d656863
> (gdb)

So *sv is bogus. That means that data->obj is bogus in:

#2  0x0807c99b in perl_cmd_perl_TAKE1 (cmd=0xbffffa10, data=0xbffffa10,
     one=0xbffffa10 "à»\001@\037") at perl_config.c:859

invoked by

#3  0x080b9fe9 in invoke_cmd (cmd=0x4001bc80, parms=0xbffffa10,
     mconfig=0x888fdb4, args=0xbfffd9e3 "") at http_config.c:828

You can test, by going to frame #2

gdb> up
gdb> up
gdb> p data->obj
gdb> p *data->obj

So most likely something is wrong with your XS code that creates the new 
directive. Show us the XS code.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
Stas Bekman wrote:

> Anthony Hinsinger wrote:
> 
>> Stas Bekman wrote:
>>
>>> Anthony Hinsinger wrote:
>>>
>>>> the missing lines :
>>>>
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 16384 (LWP 2752)]
>>>> 0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>>>>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at 
>>>> perl_config.c:898
>>>> 898         if(*sv && SvTRUE(*sv) && SvROK(*sv) && sv_isobject(*sv))
>>>
>>>
>>>
>>>
>>> good, what do you get for:
>>>
>>> gdb> p *sv
>>>
>>
>> (gdb) p *sv
>> $1 = (SV *) 0x7264656c
> 
> 
> and
> 
> p **sv?
> 

i restarted a gdb session so *sv has changed (backtrace is exactly the 
same as in previous post)

(gdb) p *sv
$2 = (SV *) 0x2d656863
(gdb) p **sv
Cannot access memory at address 0x2d656863
(gdb)

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> Stas Bekman wrote:
> 
>> Anthony Hinsinger wrote:
>>
>>> the missing lines :
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> [Switching to Thread 16384 (LWP 2752)]
>>> 0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>>>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at 
>>> perl_config.c:898
>>> 898         if(*sv && SvTRUE(*sv) && SvROK(*sv) && sv_isobject(*sv))
>>
>>
>>
>> good, what do you get for:
>>
>> gdb> p *sv
>>
> 
> (gdb) p *sv
> $1 = (SV *) 0x7264656c

and

p **sv?

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
Stas Bekman wrote:

> Anthony Hinsinger wrote:
> 
>> the missing lines :
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 16384 (LWP 2752)]
>> 0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at 
>> perl_config.c:898
>> 898         if(*sv && SvTRUE(*sv) && SvROK(*sv) && sv_isobject(*sv))
> 
> 
> good, what do you get for:
> 
> gdb> p *sv
> 

(gdb) p *sv
$1 = (SV *) 0x7264656c

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> the missing lines :
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16384 (LWP 2752)]
> 0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at perl_config.c:898
> 898         if(*sv && SvTRUE(*sv) && SvROK(*sv) && sv_isobject(*sv))

good, what do you get for:

gdb> p *sv

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
the missing lines :

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2752)]
0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at perl_config.c:898
898         if(*sv && SvTRUE(*sv) && SvROK(*sv) && sv_isobject(*sv))

Stas Bekman wrote:

> Anthony Hinsinger wrote:
> 
>> Hello,
>>
>> here is a better backtrace of my problem.
>> the strange thing is it never crash at the first request after 
>> starting the process (from gdb) .. but at the second.
>>
>> for informations, CASServerName is define as :
>>
>> { name => 'CASServerName',
>>     errmsg => 'Name of the CAS server',
>>     args_how => 'TAKE1',
>>     req_override => 'OR_AUTHCFG', }
>>
>> ---- quote ----
>> (gdb) bt
>> #0  0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at 
>> perl_config.c:898
> 
> 
> what's the segfault line reported by gdb? before you did 'bt'? it shows 
> the line/file and the code where the segfault has occured.
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> Hello,
> 
> here is a better backtrace of my problem.
> the strange thing is it never crash at the first request after starting 
> the process (from gdb) .. but at the second.
> 
> for informations, CASServerName is define as :
> 
> { name => 'CASServerName',
>     errmsg => 'Name of the CAS server',
>     args_how => 'TAKE1',
>     req_override => 'OR_AUTHCFG', }
> 
> ---- quote ----
> (gdb) bt
> #0  0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at perl_config.c:898

what's the segfault line reported by gdb? before you did 'bt'? it shows the 
line/file and the code where the segfault has occured.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> { name => 'CASServerName',
>     errmsg => 'Name of the CAS server',
>     args_how => 'TAKE1',
>     req_override => 'OR_AUTHCFG', }
> 
> ---- quote ----
> (gdb) bt
> #0  0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
>     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at perl_config.c:898

sorry to jump into the conversation late, but this strikes me as odd.  in
tracing back the code that should be DIR_CREATE and not SERVER_CREATE,
especially if you are defining an OR_AUTHCFG directive for use in a
.htaccess file.  are you defining 'sub SERVER_CREATE' in your .pm file?  you
shouldn't need one, so if you have that and SERVER_MERGE defined try taking
them out or moving them to DIR_CREATE/MERGE instead.

historically, some people have reported that directive handlers in mp1 cause
segfaults at random, similar to the way you describe in that your handler
runs but the request later segfaults.  I have not personally witnessed this
but it has been reported :)  there are also a few modules that use .htaccess
files with directive handlers, such as Apache::Dispatch and
Apache::Template, but I can't recall any reported problems there that
stemmed specifically from .htaccess files.

at this point, I think stas has gotten us as far as we can go with gdb (and
much farther than I could have, for sure).  what would be _really_ helpful
at this point would be to reduce your code as much as possible using
Apache-Test to recreate the issue, the tar it up.  see

  http://perl.apache.org/~geoff/bug-reporting-skeleton-mp1.tar.gz

for a skeleton and the README for directions.  if you can reproduce it there
it will get us much closer to tackling the issue at hand.  if it's not
reproducable once you reduce the code to just the mechanics of your hander,
then it must be your code ;)

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
Hello,

here is a better backtrace of my problem.
the strange thing is it never crash at the first request after starting 
the process (from gdb) .. but at the second.

for informations, CASServerName is define as :

{ name => 'CASServerName',
     errmsg => 'Name of the CAS server',
     args_how => 'TAKE1',
     req_override => 'OR_AUTHCFG', }

---- quote ----
(gdb) bt
#0  0x0807d151 in perl_perl_create_cfg (sv=0x888fdcc, pclass=0x816fcc4,
     parms=0xbffffa10, type=0x80ed6c9 "SERVER_CREATE") at perl_config.c:898
#1  0x080765e4 in perl_cmd_perl_TAKE123 (cmd=0xbffffa10, data=0x888fdb4,
     one=0x888fdcc "ledrezen.univ-metz.fr", two=0x0, three=0x0)
     at perl_config.c:941
#2  0x0807c99b in perl_cmd_perl_TAKE1 (cmd=0xbffffa10, data=0xbffffa10,
     one=0xbffffa10 "à»\001@\037") at perl_config.c:859
#3  0x080b9fe9 in invoke_cmd (cmd=0x4001bc80, parms=0xbffffa10,
     mconfig=0x888fdb4, args=0xbfffd9e3 "") at http_config.c:828
#4  0x080baa75 in ap_handle_command (parms=0xbffffa10, config=0x888fbac,
     l=0xbfffd9c0 "CASServerName ledrezen.univ-metz.fr") at 
http_config.c:1030
#5  0x080bab03 in ap_srm_command_loop (parms=0xbffffa10, config=0x888fbac)
     at http_config.c:1044
#6  0x080bb4b3 in ap_parse_htaccess (result=0xbffffa80, r=0x888ecec,
     override=31, d=0x888facc "/root/src/mod_perl-1.29/t/docs/",
     access_name=0x80f3e3d "") at http_config.c:1386
#7  0x080ce22f in directory_walk (r=0x888ecec) at http_request.c:582
#8  0x080cf58c in process_request_internal (r=0x888ecec) at 
http_request.c:1254
#9  0x080cf965 in ap_process_request (r=0x888ecec) at http_request.c:1348
#10 0x080c6312 in child_main (child_num_arg=0) at http_main.c:4633
#11 0x080c64c3 in make_child (s=0x8109b6c, slot=0, now=1084217908)
     at http_main.c:4748
#12 0x080c664c in startup_children (number_to_start=5) at http_main.c:4830
#13 0x080c6d3c in standalone_main (argc=6, argv=0xbffffd14) at 
http_main.c:5149
#14 0x080c75ea in main (argc=6, argv=0xbffffd14) at http_main.c:5491
---- quote ----

Thanks
Anthony

Stas Bekman wrote:

> Anthony Hinsinger wrote:
> 
>> Thanks Stas, i use gdb to trace to problem, and i get this when
>> requesting a location with a .htaccess contening my own directives (no
>> problem if directives are in httpd.conf).
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 16384 (LWP 28586)]
>> 0x0807d141 in perl_section_hash_init ()
>> (gdb) bt
>> #0  0x0807d141 in perl_section_hash_init ()
>> #1  0x080765d4 in perl_cmd_perl_TAKE123 ()
>> #2  0x0807c98b in perl_cmd_perl_TAKE1 ()
> 
> 
> Anthony, that's better but you haven't completely followed the 
> instructions at:
> http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
> 
> <QUOTE>
> If you get a core file dump (Segmentation fault), please send a 
> backtrace if possible. Before you try to produce it, re-build mod_perl 
> with:
> 
>   panic% perl Makefile.PL PERL_DEBUG=1
> 
> which will:
> 
>     * add -g to EXTRA_CFLAGS
>     * turn on PERL_TRACE
>     * set PERL_DESTRUCT_LEVEL=2 (additional checks during Perl cleanup)
>     * link against libperld if it exists
> </QUOTE>
> 
> Please do that and then produce the backtrace again. The one you 
> provided lacks the information about the arguments and file/line 
> numbers. Thanks.
> 
> 
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> Thanks Stas, i use gdb to trace to problem, and i get this when
> requesting a location with a .htaccess contening my own directives (no
> problem if directives are in httpd.conf).
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16384 (LWP 28586)]
> 0x0807d141 in perl_section_hash_init ()
> (gdb) bt
> #0  0x0807d141 in perl_section_hash_init ()
> #1  0x080765d4 in perl_cmd_perl_TAKE123 ()
> #2  0x0807c98b in perl_cmd_perl_TAKE1 ()

Anthony, that's better but you haven't completely followed the instructions at:
http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems

<QUOTE>
If you get a core file dump (Segmentation fault), please send a backtrace if 
possible. Before you try to produce it, re-build mod_perl with:

   panic% perl Makefile.PL PERL_DEBUG=1

which will:

     * add -g to EXTRA_CFLAGS
     * turn on PERL_TRACE
     * set PERL_DESTRUCT_LEVEL=2 (additional checks during Perl cleanup)
     * link against libperld if it exists
</QUOTE>

Please do that and then produce the backtrace again. The one you provided 
lacks the information about the arguments and file/line numbers. Thanks.



-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Anthony Hinsinger <an...@univ-metz.fr>.
Thanks Stas, i use gdb to trace to problem, and i get this when
requesting a location with a .htaccess contening my own directives (no
problem if directives are in httpd.conf).

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 28586)]
0x0807d141 in perl_section_hash_init ()
(gdb) bt
#0  0x0807d141 in perl_section_hash_init ()
#1  0x080765d4 in perl_cmd_perl_TAKE123 ()
#2  0x0807c98b in perl_cmd_perl_TAKE1 ()
#3  0x080b9fd9 in ap_clear_module_list ()
#4  0x080baa65 in ap_handle_command ()
#5  0x080baaf3 in ap_srm_command_loop ()
#6  0x080bb4a3 in ap_parse_htaccess ()
#7  0x080ce21f in ap_send_error_response ()
#8  0x080cf57c in ap_some_auth_required ()
#9  0x080cf955 in ap_process_request ()
#10 0x080c6302 in ap_child_terminate ()
#11 0x080c64b3 in ap_child_terminate ()
#12 0x080c663c in ap_child_terminate ()
#13 0x080c6d2c in ap_child_terminate ()
#14 0x080c75da in main ()

i also enable PERL_TRACE to 'all', and i get this at request time :

`PerlInitHandler' push_handlers() stack is empty
PerlInitHandler handlers returned -1
`PerlPostReadRequestHandler' push_handlers() stack is empty
PerlPostReadRequestHandler handlers returned -1
`PerlTransHandler' push_handlers() stack is empty
PerlTransHandler handlers returned -1
blessing cmd_parms=(0xbffffa30)
 

i hope it could help to resolve the problem.

Anthony


Le sam 08/05/2004 à 18:53, Stas Bekman a écrit :
> Anthony Hinsinger wrote:
> > Hello,
> > 
> > i'm currently writing a mod_perl authentification handler, and i want to 
> > add apache custom directives. I followed techniques explained in the 
> > mod_perl cookbook (http://www.modperlcookbook.org/chapters/ch07.pdf) 
> > using Apache::Extutils::command_table() to add 2 directives 
> > (req_override set to OR_AUTHCFG).
> > 
> > I use PerlModule into main httpd.conf to load my module, and i can 
> > successfully see it as a "C" module defining two directives with mod_info.
> > 
> > But i've a problem :
> > if i define directives into httpd.conf (in <Directory> or <Location> 
> > blocks) no problem, it works perfectly and i can retrieve directives 
> > values using Apache::ModuleConfig->get($r, __PACKAGE__);
> > But if i define directives in a .htaccess file, apache crash with this 
> > log added for each request :
> > 
> > [Mon May  3 16:12:39 2004] [notice] child pid 31813 exit signal 
> > Segmentation fault (11)
> > 
> > I don't know when apache crash exactly, because for example my 
> > authentification handler works, and i retrieve directives values. I 
> > think it crash when it send content.
> 
> Not volunteering to figure out what's wrong with it, but I can help you figure 
> out where it crashes. You either need to run the server under gdb, or 
> configure your system to allow a core dump. Either way you should get a 
> backtrace of the calls which will hopefully show what's wrong. More details 
> can be found here:
> http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
> and more extensively in the 2.0 docs:
> http://perl.apache.org/docs/2.0/devel/debug/c.html#Analyzing_Dumped_Core_Files
> 
> BTW, in mod_perl 2, adding your own directives is a piece of cake since it's 
> done in pure perl and requires no compilation:
> http://perl.apache.org/docs/2.0/user/config/custom.html
> 
> -- 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache custom directives problem

Posted by Stas Bekman <st...@stason.org>.
Anthony Hinsinger wrote:
> Hello,
> 
> i'm currently writing a mod_perl authentification handler, and i want to 
> add apache custom directives. I followed techniques explained in the 
> mod_perl cookbook (http://www.modperlcookbook.org/chapters/ch07.pdf) 
> using Apache::Extutils::command_table() to add 2 directives 
> (req_override set to OR_AUTHCFG).
> 
> I use PerlModule into main httpd.conf to load my module, and i can 
> successfully see it as a "C" module defining two directives with mod_info.
> 
> But i've a problem :
> if i define directives into httpd.conf (in <Directory> or <Location> 
> blocks) no problem, it works perfectly and i can retrieve directives 
> values using Apache::ModuleConfig->get($r, __PACKAGE__);
> But if i define directives in a .htaccess file, apache crash with this 
> log added for each request :
> 
> [Mon May  3 16:12:39 2004] [notice] child pid 31813 exit signal 
> Segmentation fault (11)
> 
> I don't know when apache crash exactly, because for example my 
> authentification handler works, and i retrieve directives values. I 
> think it crash when it send content.

Not volunteering to figure out what's wrong with it, but I can help you figure 
out where it crashes. You either need to run the server under gdb, or 
configure your system to allow a core dump. Either way you should get a 
backtrace of the calls which will hopefully show what's wrong. More details 
can be found here:
http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
and more extensively in the 2.0 docs:
http://perl.apache.org/docs/2.0/devel/debug/c.html#Analyzing_Dumped_Core_Files

BTW, in mod_perl 2, adding your own directives is a piece of cake since it's 
done in pure perl and requires no compilation:
http://perl.apache.org/docs/2.0/user/config/custom.html

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html