>On Thu, 18 Sep 2003, Stas Bekman wrote: [ ... ]
so basically we always work with f->c->pool here. please check that it's the same value at the beginning of the run and continues to be the same as you go. It definitely can't be null at any given point. to simplify debugging you can even replace all places
p = f->r ? f->r->pool : f->c->pool;
with:
p = f->c->pool;
Of course, you're right that f->c->pool isn't null at the start of modperl_filter_new() - I was reading the table wrong. I think I got it now, though, and the problem does seem to be in the apr_pcalloc() call. For modperl_filter_new():
apr_pool_t *p; modperl_filter_t *filter; p = f->r ? f->r->pool : f->c->pool; filter = (modperl_filter_t *) apr_pcalloc(p, sizeof(modperl_filter_t));
before the apr_pcalloc() call, f->c->pool is defined, and p is set equal to it (f->r is null). However, sometimes what happens right after the apr_pcalloc() call is that f->r, f->c, ... of f get set to null (including f->ctx, which causes the crash in modperl_run_filter), and filter gets set to the value of p.
So it clobbers the previously allocated memory. It's possible that the pool frees that memory and f still points to the old memory and it works fine till the moment pool reallocs it for something else. But that's the whole point of pools that there is no free(), the whole pool is getting destroyed when its life is over and in the case of f->c->pool that's the life of the whole connection. Only if the connection object is destroyed the pool get destroyed as well.
Can you step into apr_pcalloc and keep an eye on the values in p and f and see what goes wrong inside of it?
What you didn't tell me I think is whether the problem comes on the incoming or outgoing filter.
Another interesting temp workaround would be to cheat like so:
apr_pool_t *p = MP_FILTER_POOL(f);
char *fake_data = (char*)apr_palloc(p, sizeof(ap_filter_rec_t)+
sizeof(ap_filter_rec_t)+sizeof(void)+sizeof(ap_filter_t)+
sizeof(request_rec)+sizeof(conn_rec));
modperl_filter_t *filter = apr_pcalloc(p, sizeof(*filter));notice that I allocate memory for the filter and its members but don't zero them, so it won't clobber the real data. Only then I pcalloc the real memory that I'm going to use.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
