You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Rafael Garcia-Suarez <rg...@free.fr> on 2003/10/18 00:59:56 UTC
[PATCH] Re: [5.8.1] getppid is not maintained if not forked by perl
Rafael Garcia-Suarez wrote:
> I don't think this happens on mod_perl 2 with prefork MPM, but I'm not
> sure why. Could someone try with mod_perl 2 / threaded or prefork MPM to
> see if the problem on $$ exists ? (Sorry, lacking time to test this
> myself now) I see that mod_perl 2 has a function modperl_perl_init_ids()
> in modperl_perl.c. That would probably a good place to reinit PL_ppid
> as well.
And indeed this (tested) patch against mod_perl 1.99_10 fixes it.
I haven't checked if the same problem occurs with mod_perl 1.
--- src/modules/perl/modperl_perl.c.orig Fri Oct 17 22:33:58 2003
+++ src/modules/perl/modperl_perl.c Sat Oct 18 00:53:46 2003
@@ -33,6 +33,9 @@ void modperl_perl_core_global_init(pTHX)
static void modperl_perl_ids_get(modperl_perl_ids_t *ids)
{
ids->pid = (I32)getpid();
+#ifdef THREADS_HAVE_PIDS
+ ids->ppid = (I32)getppid();
+#endif
#ifndef WIN32
ids->uid = getuid();
ids->euid = geteuid();
@@ -55,6 +58,9 @@ static void modperl_perl_init_ids(pTHX_
PL_euid = ids->euid;
PL_gid = ids->gid;
PL_egid = ids->egid;
+#endif
+#ifdef THREADS_HAVE_PIDS
+ PL_ppid = ids->ppid;
#endif
}
--- src/modules/perl/modperl_perl.h.orig Fri Oct 17 22:35:57 2003
+++ src/modules/perl/modperl_perl.h Sat Oct 18 00:53:57 2003
@@ -5,6 +5,9 @@
I32 pid;
Uid_t uid, euid;
Gid_t gid, egid;
+#ifdef THREADS_HAVE_PIDS
+ Uid_t ppid;
+#endif
} modperl_perl_ids_t;
void modperl_perl_core_global_init(pTHX);
End.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Stas Bekman <st...@stason.org>.
Rafael Garcia-Suarez wrote:
> Stas Bekman wrote:
>
>>Though in your patch should we check for:
>>
>>#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 1
>>and higher and otherwise do nothing? Or do you think that checking for
>>THREADS_HAVE_PIDS is enough? won't it be set as well in 5.6.x built with threads?
>
>
> THREADS_HAVE_PIDS is set in the Linux Configure hintfile.
> For extra safety, now that you mention it, you should check for
> PERL_VERSION == 8 && PERL_SUBVERSION >= 1 || PERL_VERSION >= 9.
> (Because I integrated the hints from bleadperl to 5.6.2.)
Thanks, Rafael, committed with this correction.
BTW, there is the modperl cvs list if you want to see the cvs commits, or you
can observe them in the archives:
http://perl.apache.org/maillist/cvs.html
__________________________________________________________________
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: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Rafael Garcia-Suarez <rg...@free.fr>.
Stas Bekman wrote:
>
> Though in your patch should we check for:
>
> #if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 1
> and higher and otherwise do nothing? Or do you think that checking for
> THREADS_HAVE_PIDS is enough? won't it be set as well in 5.6.x built with threads?
THREADS_HAVE_PIDS is set in the Linux Configure hintfile.
For extra safety, now that you mention it, you should check for
PERL_VERSION == 8 && PERL_SUBVERSION >= 1 || PERL_VERSION >= 9.
(Because I integrated the hints from bleadperl to 5.6.2.)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Stas Bekman <st...@stason.org>.
Rafael Garcia-Suarez wrote:
> Stas Bekman wrote:
>
>>Nicholas Clark wrote:
>>
>>>On IRC Rafael said that he believes that his patch solves the problem
>>>without needing changes to perl. Is this the consensus view?
>>
>>Rafael's patch solves the problem in mod_perl 2.0. The problem still exists
>>for any other application that embeds perl and does the fork on its own (not
>>using pp_fork). So 5.8.2 (same as 5.8.1) may break applications that ran OK
>>under 5.8.0. I've suggested a patch to pp_getppid that fixes this problem in perl.
>
>
> On the other hand, the problem exists for $$ (there is no getpid function
> in perl) in all perls. So all applications that embed perl and that fork need
> at least to save and restore the PID (mod_perl 1 & 2 do this.) It's up to
> Nicholas to see if he wants to restore the 5.8.0 behavior in 5.8.1 but I think
> that PL_ppid will stay in 5.10.
Agreed
> I don't think your proposed patch works in the case where perl does a
> getppid(), so it marks it as cached, then the embedding application does
> a fork, and the PL_ppid_cached flag stays to "true".
Indeed, it won't work.
> (Oh, and sorry for my weak mod_perl patch-fu :) Next time I'll grab
> the CVS version.)
No problem at all ;)
__________________________________________________________________
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: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Rafael Garcia-Suarez <rg...@free.fr>.
Stas Bekman wrote:
> Nicholas Clark wrote:
> > On IRC Rafael said that he believes that his patch solves the problem
> > without needing changes to perl. Is this the consensus view?
>
> Rafael's patch solves the problem in mod_perl 2.0. The problem still exists
> for any other application that embeds perl and does the fork on its own (not
> using pp_fork). So 5.8.2 (same as 5.8.1) may break applications that ran OK
> under 5.8.0. I've suggested a patch to pp_getppid that fixes this problem in perl.
On the other hand, the problem exists for $$ (there is no getpid function
in perl) in all perls. So all applications that embed perl and that fork need
at least to save and restore the PID (mod_perl 1 & 2 do this.) It's up to
Nicholas to see if he wants to restore the 5.8.0 behavior in 5.8.1 but I think
that PL_ppid will stay in 5.10.
I don't think your proposed patch works in the case where perl does a
getppid(), so it marks it as cached, then the embedding application does
a fork, and the PL_ppid_cached flag stays to "true".
(Oh, and sorry for my weak mod_perl patch-fu :) Next time I'll grab
the CVS version.)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Stas Bekman <st...@stason.org>.
Nicholas Clark wrote:
> On Sat, Oct 18, 2003 at 10:20:35AM -0700, Stas Bekman wrote:
>
>>Rafael Garcia-Suarez wrote:
>
>
>>>And indeed this (tested) patch against mod_perl 1.99_10 fixes it.
>>
>>Thanks Rafael. In the future please post patches against the current cvs if
>>possible, as I've already applied a similar fix, though yours is definitely
>>better. The cvs version already includes a test for this bug.
>
>
> On IRC Rafael said that he believes that his patch solves the problem
> without needing changes to perl. Is this the consensus view?
Rafael's patch solves the problem in mod_perl 2.0. The problem still exists
for any other application that embeds perl and does the fork on its own (not
using pp_fork). So 5.8.2 (same as 5.8.1) may break applications that ran OK
under 5.8.0. I've suggested a patch to pp_getppid that fixes this problem in perl.
__________________________________________________________________
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: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by perl
Posted by Nicholas Clark <ni...@ccl4.org>.
On Sat, Oct 18, 2003 at 10:20:35AM -0700, Stas Bekman wrote:
> Rafael Garcia-Suarez wrote:
> >And indeed this (tested) patch against mod_perl 1.99_10 fixes it.
>
> Thanks Rafael. In the future please post patches against the current cvs if
> possible, as I've already applied a similar fix, though yours is definitely
> better. The cvs version already includes a test for this bug.
On IRC Rafael said that he believes that his patch solves the problem
without needing changes to perl. Is this the consensus view?
If so, and if I get confirmation that the hash changes restore binary
compatibility with 5.8.0 (without affecting binary compatibility with
5.8.1), I see nothing holding us back from a release candidate for 5.8.2.
(Although there will be a snapshot first, hopefully this weekend)
Given that short time between 5.8.1 and now, you can infer how much
has changed in 5.8.2-tobe :-)
Normal service (on the new timetable) will be resumed soon. Expect
5.8.3 in January 2004, and 5.8.4 about 3 months later.
(or that's the plan. if people say "5.8.2 now is crazy" enough, then
expect 5.8.2 in January, and 5.8.3 ...)
Nicholas Clark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Re: [5.8.1] getppid is not maintained if not forked by
perl
Posted by Stas Bekman <st...@stason.org>.
Rafael Garcia-Suarez wrote:
> Rafael Garcia-Suarez wrote:
>
>>I don't think this happens on mod_perl 2 with prefork MPM, but I'm not
>>sure why. Could someone try with mod_perl 2 / threaded or prefork MPM to
>>see if the problem on $$ exists ? (Sorry, lacking time to test this
>>myself now) I see that mod_perl 2 has a function modperl_perl_init_ids()
>>in modperl_perl.c. That would probably a good place to reinit PL_ppid
>>as well.
>
>
> And indeed this (tested) patch against mod_perl 1.99_10 fixes it.
Thanks Rafael. In the future please post patches against the current cvs if
possible, as I've already applied a similar fix, though yours is definitely
better. The cvs version already includes a test for this bug.
Though in your patch should we check for:
#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 1
and higher and otherwise do nothing? Or do you think that checking for
THREADS_HAVE_PIDS is enough? won't it be set as well in 5.6.x built with threads?
> --- src/modules/perl/modperl_perl.c.orig Fri Oct 17 22:33:58 2003
> +++ src/modules/perl/modperl_perl.c Sat Oct 18 00:53:46 2003
> @@ -33,6 +33,9 @@ void modperl_perl_core_global_init(pTHX)
> static void modperl_perl_ids_get(modperl_perl_ids_t *ids)
> {
> ids->pid = (I32)getpid();
> +#ifdef THREADS_HAVE_PIDS
> + ids->ppid = (I32)getppid();
> +#endif
> #ifndef WIN32
> ids->uid = getuid();
> ids->euid = geteuid();
> @@ -55,6 +58,9 @@ static void modperl_perl_init_ids(pTHX_
> PL_euid = ids->euid;
> PL_gid = ids->gid;
> PL_egid = ids->egid;
> +#endif
> +#ifdef THREADS_HAVE_PIDS
> + PL_ppid = ids->ppid;
> #endif
> }
>
> --- src/modules/perl/modperl_perl.h.orig Fri Oct 17 22:35:57 2003
> +++ src/modules/perl/modperl_perl.h Sat Oct 18 00:53:57 2003
> @@ -5,6 +5,9 @@
> I32 pid;
> Uid_t uid, euid;
> Gid_t gid, egid;
> +#ifdef THREADS_HAVE_PIDS
> + Uid_t ppid;
> +#endif
> } modperl_perl_ids_t;
>
> void modperl_perl_core_global_init(pTHX);
__________________________________________________________________
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