Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 76875 invoked from network); 31 Mar 2006 02:06:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Mar 2006 02:06:03 -0000 Received: (qmail 90405 invoked by uid 500); 31 Mar 2006 02:06:02 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 90389 invoked by uid 500); 31 Mar 2006 02:06:02 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 90378 invoked by uid 99); 31 Mar 2006 02:06:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Mar 2006 18:06:02 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gozer@ectoplasm.org designates 66.34.202.202 as permitted sender) Received: from [66.34.202.202] (HELO minerva.ectoplasm.org) (66.34.202.202) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Mar 2006 18:06:01 -0800 Received: from minerva.ectoplasm.org (localhost.localdomain [127.0.0.1]) by pmx.secure.ectoplasm.org (Postfix) with SMTP id B5DA65F533; Thu, 30 Mar 2006 18:05:40 -0800 (PST) Received: from [192.168.10.200] (unknown [192.168.10.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by minerva.ectoplasm.org (Postfix) with ESMTP id F40DD5F522; Thu, 30 Mar 2006 18:05:39 -0800 (PST) Message-ID: <442C8E71.2040302@ectoplasm.org> Date: Thu, 30 Mar 2006 18:05:37 -0800 From: "Philippe M. Chiasson" User-Agent: Thunderbird 1.5 (X11/20060313) MIME-Version: 1.0 To: Jonathan Vanasco CC: Perrin Harkins , dev@perl.apache.org Subject: [Patch] Was: Apache Reload Caveat References: <1143762143.1938.77.camel@localhost.localdomain> <91F0063F-20FC-4290-9641-44282838B952@2xlp.com> In-Reply-To: <91F0063F-20FC-4290-9641-44282838B952@2xlp.com> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig2C13E6BB08926B734EDBFA5F" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------enig2C13E6BB08926B734EDBFA5F Content-Type: multipart/mixed; boundary="------------010007030904030606080302" This is a multi-part message in MIME format. --------------010007030904030606080302 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jonathan Vanasco wrote: > On Mar 30, 2006, at 6:42 PM, Perrin Harkins wrote: >=20 >> On Thu, 2006-03-30 at 18:34 -0500, Jonathan Vanasco wrote: >>> if you subclass a module to override a few methods, and then decide >>> to remove a subclassed method (to call off the method in the parent >>> class instead), you will raise an error instead of calling the parent= >>> method. >>> if you do a restart, everything works as expected. >> Perl caches method lookups in order to reduce the performance hit =20 >> of OO >> code. If you'd like to make a patch for the A::Reload docs saying =20 >> that >> it can't handle changes that modify which package a method should be >> called in, I think that's close enough. Or, you can try this quick patch (no test for this included);-) Basically= , when causing things that might invalidate Perl's method cache, one is supposed to increase PL_sub_generation. This patch adds this behavior to Apache2::Reload and might just make this= problem go away. Feedback on success/failure would be very much appreciat= ed. -------------------------------------------------------------------------= ------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 8= 8C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 8= 8C3A5A5 --------------010007030904030606080302 Content-Type: text/x-patch; name="sub_generation.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="sub_generation.diff" Index: lib/Apache2/Reload.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/Apache2/Reload.pm (revision 390295) +++ lib/Apache2/Reload.pm (working copy) @@ -167,6 +167,8 @@ my $package =3D module_to_package($module); ModPerl::Util::unload_package($package); } + + ModPerl::Util::invalidate_perl_method_cache(); =20 #Then, let's reload them all, so that module dependencies can satisf= y #themselves in the correct order. Index: xs/tables/current/ModPerl/FunctionTable.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- xs/tables/current/ModPerl/FunctionTable.pm (revision 390295) +++ xs/tables/current/ModPerl/FunctionTable.pm (working copy) @@ -4338,6 +4338,16 @@ ] }, { + 'return_type' =3D> 'void', + 'name' =3D> 'modperl_perl_method_cache_invalidate', + 'args' =3D> [ + { + 'type' =3D> 'PerlInterpreter *', + 'name' =3D> 'my_perl' + }, + ] + }, + { 'return_type' =3D> 'int', 'name' =3D> 'modperl_perl_module_loaded', 'attr' =3D> [ Index: xs/ModPerl/Util/ModPerl__Util.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- xs/ModPerl/Util/ModPerl__Util.h (revision 390295) +++ xs/ModPerl/Util/ModPerl__Util.h (working copy) @@ -38,4 +38,7 @@ #define mpxs_ModPerl__Util_unload_package_xs(pkg) \ modperl_package_unload(aTHX_ pkg) =20 +#define mpxs_ModPerl__Util_invalidate_perl_method_cache() \ + modperl_perl_method_cache_invalidate(aTHX) + /* ModPerl::Util::exit lives in mod_perl.so, see modperl_perl.c */ Index: xs/maps/modperl_functions.map =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- xs/maps/modperl_functions.map (revision 390295) +++ xs/maps/modperl_functions.map (working copy) @@ -8,6 +8,7 @@ SV *:DEFINE_current_perl_id char *:DEFINE_current_callback=20 DEFINE_unload_package_xs | | const char *:package + void:DEFINE_invalidate_perl_method_cache =20 MODULE=3DModPerl::Global mpxs_ModPerl__Global_special_list_call Index: src/modules/perl/modperl_util.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src/modules/perl/modperl_util.h (revision 390295) +++ src/modules/perl/modperl_util.h (working copy) @@ -100,6 +100,8 @@ apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t *p, SV *avrv); void modperl_package_unload(pTHX_ const char *package); +void modperl_perl_method_cache_invalidate(pTHX); + #if defined(MP_TRACE) && APR_HAS_THREADS #define MP_TRACEf_TID "/tid 0x%lx" #define MP_TRACEv_TID (unsigned long)apr_os_thread_current() Index: src/modules/perl/modperl_util.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src/modules/perl/modperl_util.c (revision 390295) +++ src/modules/perl/modperl_util.c (working copy) @@ -796,6 +796,11 @@ =20 } =20 +void modperl_perl_method_cache_invalidate(pTHX) +{ + PL_sub_generation++; +} + #define MP_RESTART_COUNT_KEY "mod_perl_restart_count" =20 /* passing the main server object here, just because we don't have the --------------010007030904030606080302-- --------------enig2C13E6BB08926B734EDBFA5F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFELI5xyzKhB4jDpaURA3mQAJ99vincCvM2fm++MzKfVnCmQQgDegCgqXvQ 70yavH8GqlZjtKTNEhDHGuQ= =6t35 -----END PGP SIGNATURE----- --------------enig2C13E6BB08926B734EDBFA5F--