httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wortham" <>
Subject Re: Whitescreens when using a dir-conf merge function
Date Thu, 08 Feb 2007 00:46:14 GMT
   Thanks for the response.

   I think I have tracked the whitescreening issue down to mutating the
newly allocated dir_cfg in the merge function, but I can't figure out why
setting memory that has just been allocated would error (perhaps the
apr_pcalloc returned an error and did not retrieve the memory requested?).

My comments to your response follow:

> When I finished the function, I noticed that it was causing whitescreens
> > (empty responses).
> "White screens" in my experience are often caused by the apache process
> segfaulting (though you didn't mention what platform you are on; this is
> unix-ish).

I am testing on LINUX, and that's where my whitescreens are showing up
(haven't started cross-platform testing yet).  I have encountered them in
the past and they culprit has always been a segfault.
I suspected a segfault-like error at the end of startup causing the
whitescreens, but I don't yet have a way to verify this.  Also, I don't know
where in my code the segfault could have occurred (unless the memory
allocation request was denied).

  Have you checked your apache error log to see if this is the
> case?  You also may want to change your LogLevel to "debug" to get the
> most information possible into those logs.

My module is particularly large and I have, therefore, made very extensive
use of logging (many sets of files and structure/memory dumps to both STDERR
and error.log).
Nothing seems to show up in the error log (and nothing [other than my
standard debugging code] shows up in the STDERR console where I startup the
http daemon).
I will do some more testing with more verbose logging later this evening.

> As you can see below, I allocate memory via 'apr_pcalloc' and then I:
> > (1) loop through each existing 'rbl_handler' from the parentdir_cfg,
> > copying
> > it to the new_dir_cfg, then
> > (2) loop through each existing 'rbl_handler' from the subdir_cfg,
> > copying it
> > to the new_dir_cfg.
> A VERY brief look at your code looks like you're moving pointers; you
> may want to consider using apr_pstrdup and/or memcpy instead, unless you
> are SURE the pointers in question are pointing at things which are in a
> long-life pool.

The whitescreens show after either copying integers or 'apr_pstrdup'ing
strings (or both).  A segfault can't occur when setting "int x = (int)y",
can it?  I'm thinking that since the assignment-side is part of a struct
which is in dyn-allocated memory, that is a potential point for the
Memcpy also caused the same errors... I have those lines commented out in my
sample code.  Can you think of any reason 'memcpy' would cause a segfault
(or other similar error)?
My assumption is that the pool (the first parameter of the merge function)
should last for the life of the newly created dir_cfg... am I wrong?

> Todd

Any more ideas?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message