httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject [PATCH] solves the mod_mime seg fault without loosing the hash?
Date Wed, 15 Aug 2001 02:39:54 GMT
From: "Bill Stoddard" <bill@wstoddard.com>
Sent: Tuesday, August 14, 2001 4:26 PM


> > This is getting obscene.  We've lost all value of tables, since they can't be memcpy'ed,
> > they have to be reconstructed.  This will be much slower than the original array
code.

The option, Bill, to eliminate the hash entirely, is still in the realm of consideration.
But that patch can't undo Roy's and my bug fixes (that weren't related to the hash.)

> > I'll demonstrate a solution, using pool scopes, that adds safety and speed.  Give
me a day.
> 
> Hit send before I was finished.  If pool scopes significantly increases the complexity
of
> this code, I will likely veto it.  So you might want to share what you are planning on
> doing before you invest much time in it.  I learned a lesson working on this code...
the
> dir_create() and dir_merge() code needs to be as straight forward and easy to understand
> as possible to keep bugs out.  Gaining 5% performance at the expense of a 100% increase
in
> code complexity is not an acceptable trade off. The copy_mappings, et. al. was more like
a
> 1000% increase in complexity.

OK.  More complex, and not 'tweaked' for legibility.  Rather than make you all wait, 
I'm posting as-is, and won't commit yet, since we have some contention about the 'right' 
solution.

The list of 'optimizable cases' shrinks in this patch.  ->copy/copy_mappings is gone.
We only care that the cfg->pool and entry->pool are in-scope.  If they aren't, we copy.
We've got to copy when we merge or remove.  OH ... this patch defers the forced
'hash_make' until we actually add an entry.  You may want to ignore that change (set
new->extension_mappings = apr_hash_make(p); in line 152) to continue to reproduce the
segfault reliably.

remove-items is kluged to eliminate a ton of lines (three reps).  Less prone to error, 
I hope.  The big headache is the 'member' index into the exinfo structure.  That 'offset'

code gets ugly, perhaps someone has a better/cleaner solution (using a macro or some such.)

Anyways, I've wrapped my brain around this another three hours.  Try this patch if you can
reproduce the segfault (I can't, but couldn't before) and report back.

Bill


Mime
View raw message