httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [mp2 patch] getting APR to work w/o modperl
Date Sun, 16 May 2004 19:28:44 GMT
Joe Schaefer wrote:
> Stas Bekman <> writes:
> [...]
>>I guess all you need to do is to change xs/APR/APR/Makefile.PL to
>>collect all .o files from under xs/APR and a few selected
>>src/modules/perl/modperl_xxx.o and link them statically with if
>>under win32. (and may be some other platforms too (aix comes to mind)).
> Before we get into all that, I would like to know why APR::Pool has 
> any interaction with modperl's thread-pools. I really don't understand 
> why pool cleanup needs to decrement a tipool refcount [*]; why doesn't 
> this introduce all kind of refcount-related bugs when mp2 users start
> creating/destroying their own subpools?
> If there's a design flaw here, then fixing the design flaw may
> allow us to avoid such platform-specific linking hacks.
> [*] ie, all the "#idef USE_ITHREADS" code in APR__Pool.h

The reason it is there is not in a design flow,  but the fact that when you 
register a cleanup handler, you no longer have control over when it's going to 
be run. What you have to ensure is that if you use a pool of interpreters, and 
you take one of them to register the cleanup handler, you must not release it 
until that cleanup handler has been run. Why? Because it passes SV which is 
allocated and lives inside that interpreter, and that SV could be absolutely 
anything (huge object). When the cleanup callback is run, you must have that 
same interpreter to run it, or things will go boom.

Granted you could try to freeze the SV recursively via Storable and handle 
over a frozen struct, and then thaw it before running with any other 
interpreter, but it'll be much slower. ALso if you pass an anon code ref, 
it'll have to be B::Deparse'd as we do now for all other handlers, which you 
want to avoid too.

Second, this issue is really not the reason we are doing what we are doing. If 
you look at my patch (in this thread), I simply hacked that in xs/APR/APR/APR.xs:

/* XXX: provide the missing symbol for APR::Pool as a tmp workaround  */
#ifndef modperl_interp_unselect
apr_status_t modperl_interp_unselect(void *data);
apr_status_t modperl_interp_unselect(void *data) { return APR_SUCCESS; }

and there is no more problem. The multiple other dependencies on the modperl_* 
files are the problem that win32 has with (and probably aix).

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

View raw message