httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "fkater@googlemail.com" <fka...@googlemail.com>
Subject Re: external redirect
Date Fri, 23 Jan 2009 10:33:29 GMT
Peter Poeml:

> It should work just like that. In which line does the
> crash precisely happen?

In my code (see below) it is triggered if I try to set the
apr_table_t and *then* return. When returning *only* there
is no seg fault. Please see the comments in the code.  It
must be something trivial...

I recompiled apache with debugging symbols, however, I
failed to track the issue with the debugger gdb since I am
not very familiar with it. Is there an easy way to get more
info about the crash?


> If the innocent looking lines trigger this, I would expect
> that something is hosed already when they are reached,
> something like corruption of the request object by
> something else which is going on "above".


FYI, this is my little module:


#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
#include "apr_strings.h"

static int done_once=FALSE;

static int _hook_access_checker(request_rec* r){

  if(done_once) return DECLINED;
  else{
    done_once=TRUE;

    // ok:
    //return HTTP_MOVED_TEMPORARILY;
    
    // seg fault:
    // char* uri=apr_pstrdup(r->pool,"http://localhost/abcdef");
    // apr_table_setn(r->headers_out,"Location",uri);

    // seg fault (as well):
    char* uri=apr_pstrdup(r->pool,"http://localhost/abcdef");
    apr_table_setn(r->err_headers_out,"Location",uri);

    return HTTP_MOVED_TEMPORARILY;
  }
}

static void _hooks_register(apr_pool_t *p){
  ap_hook_access_checker(
    _hook_access_checker,NULL,NULL,APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA mod_hs={
  STANDARD20_MODULE_STUFF,
  NULL, NULL, NULL, NULL, NULL, _hooks_register
};


> Can you reproduce it easily, i.e. with starting the server
> and issueing a single request?

Yes, exactly. I restart apache, open the browser to
http://localhost and then apache crashs.
/var/log/apache2/error_log:

[Fri Jan 23 11:02:35 2009] [notice] Apache/2.2.10 (Unix)
DAV/2 mod_ssl/2.2.10 OpenSSL/0.9.8j SVN/1.5.4 configured --
resuming normal operations

[Fri Jan 23 11:02:40 2009] [notice] child pid 12364 exit
signal Segmentation fault (11)

[Fri Jan 23 11:04:19 2009] [notice] caught SIGTERM, shutting
down

Hm...

 Felix



Mime
View raw message