You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2005/04/06 17:05:54 UTC

svn commit: r160301 - in perl/modperl/trunk: Changes src/modules/perl/modperl_util.h

Author: stas
Date: Wed Apr  6 08:05:52 2005
New Revision: 160301

URL: http://svn.apache.org/viewcvs?view=rev&rev=160301
Log:
make sure not to use apr_os_thread_current in debug mode when libapr
wasn't built with threads support

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/src/modules/perl/modperl_util.h

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&r1=160300&r2=160301
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Apr  6 08:05:52 2005
@@ -18,6 +18,9 @@
      1.99_XX. Please read the below changes carefully.
     ***************************************************
 
+make sure not to use apr_os_thread_current in debug mode when libapr 
+wasn't built with threads support [Stas]
+
 Apache2::RequestRec->new now sets $r->request_time [Stas]
 
 s/Apache::/Apache2::/g and s/mod_perl/mod_perl2/g in all module

Modified: perl/modperl/trunk/src/modules/perl/modperl_util.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.h?view=diff&r1=160300&r2=160301
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_util.h (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_util.h Wed Apr  6 08:05:52 2005
@@ -102,7 +102,11 @@
 void modperl_package_unload(pTHX_ const char *package);
 #if defined(MP_TRACE) && defined(APR_HAS_THREADS)
 #define MP_TRACEf_TID   "/tid 0x%lx"
+#if APR_HAS_THREADS
 #define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
+#else
+#define MP_TRACEv_TID   0
+#endif
 #define MP_TRACEv_TID_  MP_TRACEv_TID,
 #define MP_TRACEv__TID  ,MP_TRACEv_TID
 #else



Re: the issue with APR_HAS_THREADS

Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
>> I think that means a simple thing. You had Apache first installed with 
>> libapr as a part of it and that libapr was built with threads so the 
>> header file was:
>>
>>  apache/include/apr.h:#define APR_HAS_THREADS           1
>>
>> now you build a new libapr, and its header files are installed 
>> elsewhere. But you still have apache/include/apr.h from above, and 
>> that's the one that mod_perl's build process picks. Is that the case?
>>
> I think you said it backwards...
> 
> I had 1 apr installed in /usr/local/. outside of httpd without threads. 
> this came from the install of subversion via freebds 
> ports(/usr/ports/devel/subversion) .
> 
> I then had one installed with httpd w/ threads in 
> /home/pgollucci/dev/inst/httpd/2.1.5-dev/prefork/ based on my subversion
> checkouts of httpd2,apr,apr-util.  (I had to build/install subversion as 
> above first to do this)
> 
> The first was in my path so it was used as the lib despite my --with-apr 
> option to configure.
> 
> The header file [apache/include/apr.h] got generated with threads 
> because of --enable-maintainer-mode I passed to httpd which did imply 
> threads as it should.
> 
> So now I have a header/library mismatch. It got worse so that my httpd
> was linked with _BOTH_ APRs.  The non threading one was first in the ldd
> output of httpd -- I guess its first come first serve.  HTTPD managed to 
> compile and run somehow.  This double linking blew up in face when I got 
> to the mp2 make stage.
> 
> After wasting a lot of my time... and probably others... I'd say this is 
> likely a mix up on my part and/or httpd's configure did not honor my 
> --with-apr options... I'll follow this up on dev@apr.apache.org

Assuming that you load a correct libapr(-util).so (i.e. it's the same 
libapr(-util).so as the one reported by the script provided by 
MP_APR_CONFIG value) this is a bug in modperl. It shouldn't assume that 
apr headers are in the apache/include directory and query the apr-config 
for the location of the headers.

If not (i.e. you didn't not supply MP_APR_CONFIG at build time), then it's 
your problem, but we should try to detect that and explain to the user 
what went wrong. The problem is that sometimes libapr sits in /usr/lib and 
it of course gets loaded instead of the right lib from apache/libs/

As always patches are welcome :)


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: the issue with APR_HAS_THREADS

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> I think that means a simple thing. You had Apache first installed with 
> libapr as a part of it and that libapr was built with threads so the 
> header file was:
> 
>  apache/include/apr.h:#define APR_HAS_THREADS           1
> 
> now you build a new libapr, and its header files are installed 
> elsewhere. But you still have apache/include/apr.h from above, and 
> that's the one that mod_perl's build process picks. Is that the case?
> 
I think you said it backwards...

I had 1 apr installed in /usr/local/. outside of httpd without threads. 
this came from the install of subversion via freebds 
ports(/usr/ports/devel/subversion) .

I then had one installed with httpd w/ threads in 
/home/pgollucci/dev/inst/httpd/2.1.5-dev/prefork/ based on my subversion
checkouts of httpd2,apr,apr-util.  (I had to build/install subversion as 
above first to do this)

The first was in my path so it was used as the lib despite my --with-apr 
option to configure.

The header file [apache/include/apr.h] got generated with threads 
because of --enable-maintainer-mode I passed to httpd which did imply 
threads as it should.

So now I have a header/library mismatch. It got worse so that my httpd
was linked with _BOTH_ APRs.  The non threading one was first in the ldd
output of httpd -- I guess its first come first serve.  HTTPD managed to 
compile and run somehow.  This double linking blew up in face when I got 
to the mp2 make stage.

After wasting a lot of my time... and probably others... I'd say this is 
likely a mix up on my part and/or httpd's configure did not honor my 
--with-apr options... I'll follow this up on dev@apr.apache.org

END
------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: the issue with APR_HAS_THREADS

Posted by Stas Bekman <st...@stason.org>.
[subject changed]

[don't forget to CC the list :)]

Philip M. Golllucci wrote:
>> Oops, that's correct. I've reverted that.
>>
>> so what you are saying is that httpd has APR_HAS_THREADS but if you 
>> get to load a different libapr which doesn't have threads enabled we 
>> are screwed. Right?
>>
> Try this:
> svn co apr
> snv co apr-util
> ./configure --prefix=/apr --don't enable threads
> make all install
> 
> cd /back/to/apr-util
> ./configure --prefix=/apr-util --with-apr=/apr/bin/apr-1-config
> 
> cd /some/wildly other dir
> svn co httpd
> ./configure --with-apr=/apr/bin/apr-1-config 
> --with-apr-util=/apr-util/bin/apu-1-config
> --enable-maintainer-mode
> --prefix=/httpd
> 
> cd /another dir
> svn co modperl2
> perl Makefile.PL MP_APXS=/httpd/bin/apxs MP_MAINTAINER=1 MP_TRACE=1
> make
> ....
> [error]

I think that means a simple thing. You had Apache first installed with libapr as a part of it and that libapr was built with threads so the header file was:

  apache/include/apr.h:#define APR_HAS_THREADS           1

now you build a new libapr, and its header files are installed elsewhere. But you still have 
apache/include/apr.h from above, and that's the one that mod_perl's build process picks. Is that the case?

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org 
mailto:stas@stason.org http://use.perl.org http://apacheweek.com  
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: svn commit: r160301 - in perl/modperl/trunk: Changes src/modules/perl/modperl_util.h

Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> stas@apache.org wrote:
> 
>> +make sure not to use apr_os_thread_current in debug mode when libapr 
>> +wasn't built with threads support [Stas]
>> +
>>  Apache2::RequestRec->new now sets $r->request_time [Stas]
> 
> 
>> Modified: perl/modperl/trunk/src/modules/perl/modperl_util.h
>> URL: 
>> http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.h?view=diff&r1=160300&r2=160301 
>>
>> ============================================================================== 
>>
>> --- perl/modperl/trunk/src/modules/perl/modperl_util.h (original)
>> +++ perl/modperl/trunk/src/modules/perl/modperl_util.h Wed Apr  6 
>> 08:05:52 2005
>> @@ -102,7 +102,11 @@
>>  void modperl_package_unload(pTHX_ const char *package);
>>  #if defined(MP_TRACE) && defined(APR_HAS_THREADS)
>>  #define MP_TRACEf_TID   "/tid 0x%lx"
>> +#if APR_HAS_THREADS
>>  #define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
>> +#else
>> +#define MP_TRACEv_TID   0
>> +#endif
>>  #define MP_TRACEv_TID_  MP_TRACEv_TID,
>>  #define MP_TRACEv__TID  ,MP_TRACEv_TID
>>  #else
>>
>>
> Stas, appologies... After retesting this, I came to the following:
> --enable-maintainer-mode _DOES_ imply --enable-threads in APR
> _BUT_
> only if APR is compiled and installed as part of HTTP2.
> 
> If you install APR outside of HTTPD2 as a "system library"
> (I don't think we support this yet as APR isn't quite ready?)
> then you must also compile APR with --enable-maintainer-mode.
> 
> This broke the MP2 requirement of requiring httpd2 to be built with 
> --enable-maintainer-mode as stated on the webpage docs as it assumes
> HTTPD2.

Not really, there is no such requirement. I think the issue is different, please see below.

> Also, this function was already inside
>  >  #if defined(MP_TRACE) && defined(APR_HAS_THREADS)
> 
> I did this test against r160300

Oops, that's correct. I've reverted that.

so what you are saying is that httpd has APR_HAS_THREADS but if you get to load a different libapr which doesn't have threads enabled we are screwed. Right?

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org 
mailto:stas@stason.org http://use.perl.org http://apacheweek.com  
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: svn commit: r160301 - in perl/modperl/trunk: Changes src/modules/perl/modperl_util.h

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Sorry, let me correct my sentence fragment:

 >This broke the MP2 requirement of requiring httpd2 to be built with 
 >--enable-maintainer-mode as stated on the webpage docs as it assumes
 >HTTPD2.

requirement of requiring httpd2 to be built with 
--enable-maintainer-mode as stated on the webpage docs as it assumes
APR is compiled as part of HTTP2



END
------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: svn commit: r160301 - in perl/modperl/trunk: Changes src/modules/perl/modperl_util.h

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
stas@apache.org wrote:
> +make sure not to use apr_os_thread_current in debug mode when libapr 
> +wasn't built with threads support [Stas]
> +
>  Apache2::RequestRec->new now sets $r->request_time [Stas]

> Modified: perl/modperl/trunk/src/modules/perl/modperl_util.h
> URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_util.h?view=diff&r1=160300&r2=160301
> ==============================================================================
> --- perl/modperl/trunk/src/modules/perl/modperl_util.h (original)
> +++ perl/modperl/trunk/src/modules/perl/modperl_util.h Wed Apr  6 08:05:52 2005
> @@ -102,7 +102,11 @@
>  void modperl_package_unload(pTHX_ const char *package);
>  #if defined(MP_TRACE) && defined(APR_HAS_THREADS)
>  #define MP_TRACEf_TID   "/tid 0x%lx"
> +#if APR_HAS_THREADS
>  #define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
> +#else
> +#define MP_TRACEv_TID   0
> +#endif
>  #define MP_TRACEv_TID_  MP_TRACEv_TID,
>  #define MP_TRACEv__TID  ,MP_TRACEv_TID
>  #else
> 
> 
Stas, appologies... After retesting this, I came to the following:
--enable-maintainer-mode _DOES_ imply --enable-threads in APR
_BUT_
only if APR is compiled and installed as part of HTTP2.

If you install APR outside of HTTPD2 as a "system library"
(I don't think we support this yet as APR isn't quite ready?)
then you must also compile APR with --enable-maintainer-mode.

This broke the MP2 requirement of requiring httpd2 to be built with 
--enable-maintainer-mode as stated on the webpage docs as it assumes
HTTPD2.

Also, this function was already inside
 >  #if defined(MP_TRACE) && defined(APR_HAS_THREADS)

I did this test against r160300


END
------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org