You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <st...@raleigh.ibm.com> on 2000/02/04 02:37:13 UTC

mod_mmap_static translation hook is never called

There is a bug here but I'm not sure of the proper way to fix it. In build,
I have 3 translate hooks registered.  The mod_mmap_static hook is registered
to run last as follows.

    ap_hook_translate_name(mmap_static_xlat, aszPre, NULL, HOOK_LAST);

aszPre points to the core translate routine but from what I can tell it is
never used. What is this field used for?

The hooks are sorted in the _hooks.link.traslate_name list in this order:

mod_alias
mod_core
mod_mmap

The translate hooks are implemented as IMPLEMENT_HOOK_RUN_FIRST. mod_alias
declines, mod_core does NOT decline thus the mod_mmap hook is never called.
Then I tried registering the mod_mmap hook as follows:

    ap_hook_translate_name(mmap_static_xlat, aszPre, NULL, HOOK_MIDDLE);

Now the translate name hook list is sorted like this:

mod_alias
mod_mmap
mod_core

Arghhh, still foiled. mod_mmap depend on mod_core being run before it is run
to set the r->filename field. In Apache 1.3, mod_mmap_static calls
core_translate directly (and we can do the same here, but it's such an ugly
hack...).  How should this work with the new hooks?

Bill



______________________________________________
Bill Stoddard

Come to the first official Apache Software Foundation
Conference!  <http://ApacheCon.Com/>



Re: mod_mmap_static translation hook is never called

Posted by David Reid <ab...@dial.pipex.com>.
Bill,

When I hacked mod_mmap_static over to apache 2.0 I brought up this issue and
didn't find an answer either.  The code that I ended up with was the best
that could be done at the time without a lot of messing with hooks etc which
we don't really want to do.

Sorry it took a while to respond but I've been away for a couple of
days...Moscow is very cold and snowy!
:-)
david
----- Original Message -----
From: "Bill Stoddard" <st...@raleigh.ibm.com>
To: <ne...@apache.org>
Sent: Friday, February 04, 2000 6:11 PM
Subject: Re: mod_mmap_static translation hook is never called


>
> ----- Original Message -----
> From: Bill Stoddard <st...@raleigh.ibm.com>
> To: <ne...@apache.org>
> Sent: Friday, February 04, 2000 11:11 AM
> Subject: Re: mod_mmap_static translation hook is never called
>
>
> >
> > > "Bill Stoddard" <st...@raleigh.ibm.com> wrote:
> > > >
> > > >There is a bug here but I'm not sure of the proper way to fix it.
> > > >[...] mod_mmap depend on mod_core being run before it is run to set
> > > >the r->filename field. In Apache 1.3, mod_mmap_static calls
> > > >core_translate directly (and we can do the same here, but it's such
> > > >an ugly hack...). How should this work with the new hooks?
> > >
> > > What mod_mmap_static wants is an extra hook between filename
> > > translation and the directory walking because only at that point it is
> > > able to say "I know about that file!" and short-circuit all the
> > > stat()s. A more general information cacheing system would hook in
> > > there too; I don't know whether this is enough argument for adding
> > > another hook.
> Just an FYI... I copied the core_translate code into mod_mmap just for
grins
> (and maybe this is a 'fix'). Eliminating the extra ap_stat() improved
> performance 15% (on Windows) when fetching a 500 byte file. I'd expect
less
> of a difference on Linux.
>
> Bill
>


Re: mod_mmap_static translation hook is never called

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
----- Original Message -----
From: Bill Stoddard <st...@raleigh.ibm.com>
To: <ne...@apache.org>
Sent: Friday, February 04, 2000 11:11 AM
Subject: Re: mod_mmap_static translation hook is never called


>
> > "Bill Stoddard" <st...@raleigh.ibm.com> wrote:
> > >
> > >There is a bug here but I'm not sure of the proper way to fix it.
> > >[...] mod_mmap depend on mod_core being run before it is run to set
> > >the r->filename field. In Apache 1.3, mod_mmap_static calls
> > >core_translate directly (and we can do the same here, but it's such
> > >an ugly hack...). How should this work with the new hooks?
> >
> > What mod_mmap_static wants is an extra hook between filename
> > translation and the directory walking because only at that point it is
> > able to say "I know about that file!" and short-circuit all the
> > stat()s. A more general information cacheing system would hook in
> > there too; I don't know whether this is enough argument for adding
> > another hook.
Just an FYI... I copied the core_translate code into mod_mmap just for grins
(and maybe this is a 'fix'). Eliminating the extra ap_stat() improved
performance 15% (on Windows) when fetching a 500 byte file. I'd expect less
of a difference on Linux.

Bill


Re: mod_mmap_static translation hook is never called

Posted by David Reid <ab...@dial.pipex.com>.
When I started looking at mod_mmap_static it did strike me that we should
perhaps review the way that we handled all the translations.  I didn't
openly suggest it as the jahid that followed would be bloody and probably
wasn't worth it, but as it's being raised anyway...

d :-)
----- Original Message -----
From: "Tony Finch" <do...@dotat.at>
To: <ne...@apache.org>
Sent: Saturday, February 05, 2000 4:44 AM
Subject: Re: mod_mmap_static translation hook is never called


> "Bill Stoddard" <st...@raleigh.ibm.com> wrote:
> >
> >Yes, I know why mod_mmap needs the hook.
>
> That was more for my own benefit -- thinking it through out loud...
>
> >I don't want to add an extra hook either. I was hoping for a
> >breakthrough in-sight. Bleh, it's as bad as I thought...
>
> Yeah.
>
> It occured to me later that the directory walking stuff which happens
> around this point would need to be abstracted out if you wanted to use
> a non-filesystem document store like a database or (!) mod_mmap_static.
> It's still a bit pie in the sky but it makes the extra hook look less
> pointless.
>
> Tony.
> --
>                **                              **
> ***   ***   ***  **** ***   *******   ***   ***  **** ***   ****
>    ***   ***         *   ***       ***   ***         *   ***


Re: mod_mmap_static translation hook is never called

Posted by Greg Stein <gs...@lyra.org>.
On Sat, 5 Feb 2000, Tony Finch wrote:
> "Bill Stoddard" <st...@raleigh.ibm.com> wrote:
> >
> >Yes, I know why mod_mmap needs the hook.
> 
> That was more for my own benefit -- thinking it through out loud...
> 
> >I don't want to add an extra hook either. I was hoping for a
> >breakthrough in-sight. Bleh, it's as bad as I thought...
> 
> Yeah.
> 
> It occured to me later that the directory walking stuff which happens
> around this point would need to be abstracted out if you wanted to use
> a non-filesystem document store like a database or (!) mod_mmap_static.
> It's still a bit pie in the sky but it makes the extra hook look less
> pointless.

That stuff in there is kind of a pain in the butt. You can't really avoid
it, and (conversely) you can't call it when you need to. Urk.

mod_dav can operate against a database, so we've seen some of these
problems. I haven't concentrated on it too hard because the database code
is either in early development (some MySQL stuff) or some proprietary
stuff that I haven't seen (sigh).

One of the other hook-related things that I've seen is telling Apache to
perform an authentication check. Currently, Apache will only go through
the motions if there is a "require" statement. Under the WebDAV protocol,
there are cases where people can/should be able to operate anonymous
(meaning "require" shouldn't be applied to that method(s)), yet we need to
later force an authentication to occur (so we can perform some
authorization). In particular, take the POST method. Normally, anybody can
do this. However, if somebody performs a LOCK on the CGI (or a parent
resource), then POST requires the lock-token and an authentication before
allowing the POST through. Basically, Apache doesn't quite give us the
hooks for this. I decided to blow it off for 1.3, but will dig into 2.0
once I start moving mod_dav over to the 2.0 framework.
( just a heads up re: hooks )

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


Re: mod_mmap_static translation hook is never called

Posted by Tony Finch <do...@dotat.at>.
"Bill Stoddard" <st...@raleigh.ibm.com> wrote:
>
>Yes, I know why mod_mmap needs the hook.

That was more for my own benefit -- thinking it through out loud...

>I don't want to add an extra hook either. I was hoping for a
>breakthrough in-sight. Bleh, it's as bad as I thought...

Yeah.

It occured to me later that the directory walking stuff which happens
around this point would need to be abstracted out if you wanted to use
a non-filesystem document store like a database or (!) mod_mmap_static.
It's still a bit pie in the sky but it makes the extra hook look less
pointless.

Tony.
-- 
               **                              **               
***   ***   ***  **** ***   *******   ***   ***  **** ***   ****
   ***   ***         *   ***       ***   ***         *   ***    

Re: mod_mmap_static translation hook is never called

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> "Bill Stoddard" <st...@raleigh.ibm.com> wrote:
> >
> >There is a bug here but I'm not sure of the proper way to fix it.
> >[...] mod_mmap depend on mod_core being run before it is run to set
> >the r->filename field. In Apache 1.3, mod_mmap_static calls
> >core_translate directly (and we can do the same here, but it's such
> >an ugly hack...). How should this work with the new hooks?
>
> What mod_mmap_static wants is an extra hook between filename
> translation and the directory walking because only at that point it is
> able to say "I know about that file!" and short-circuit all the
> stat()s. A more general information cacheing system would hook in
> there too; I don't know whether this is enough argument for adding
> another hook.
>
Yes, I know why mod_mmap needs the hook. I am working on a file handle cache
for Windows and the extra stat really sucks up cycles on Windows. The easy
way out is to call core_translate directly, which is what we were doing in
Apache 1.3 (is this why the module is considered experimental :-). I don't
want to add an extra hook either. I was hoping for a breakthrough in-sight.
Bleh, it's as bad as I thought...

Bill




Re: mod_mmap_static translation hook is never called

Posted by Tony Finch <do...@dotat.at>.
"Bill Stoddard" <st...@raleigh.ibm.com> wrote:
>
>There is a bug here but I'm not sure of the proper way to fix it.
>[...] mod_mmap depend on mod_core being run before it is run to set
>the r->filename field. In Apache 1.3, mod_mmap_static calls
>core_translate directly (and we can do the same here, but it's such
>an ugly hack...). How should this work with the new hooks?

What mod_mmap_static wants is an extra hook between filename
translation and the directory walking because only at that point it is
able to say "I know about that file!" and short-circuit all the
stat()s. A more general information cacheing system would hook in
there too; I don't know whether this is enough argument for adding
another hook.

Tony.
-- 
               **                              **               
***   ***   ***  **** ***   *******   ***   ***  **** ***   ****
   ***   ***         *   ***       ***   ***         *   ***