You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Forbes <mf...@suscom.net> on 2002/10/30 23:53:50 UTC
hangs on $ENV{'QUERY_STRING'}
My apologies in advance if this is something that's been described &
solved before... I can't seem to find the answer in archival searches
(maybe I'm just using the wrong terms).
At any rate, I have a fairly large script that I wrote when operating
under Apache 1.3, perl 5.8.0, Redhat 7.3. I'm now running Apache 2.0,
perl 5.8.0, and Redhat 8.0... and it stopped working when I performed
the upgrade.
Anywhere, what's happening is that the code below this paragraph is just
hanging...(on the second line, I've inserted a few "print
'debug<BR>\n';" lines in the real thing to make sure.) it does finally
time out, without producing any output.
here's the relevant code:
$pass = "/cgi-bin/plaintextresult.cgi?$ENV{'QUERY_STRING'}";
print "<TD WIDTH='33%' ALIGN='CENTER' BGCOLOR='#222222'><A
HREF=\"$pass\" target='printerfriendly'>Plain text version</A></TD>\n";
Thanks in advance, and again, sorry if this is a FAQ, I just couldn't
find the answer anywhere.
-Mike Forbes
mforbes@suscom.net
Re: hangs on $ENV{'QUERY_STRING'}
Posted by Perrin Harkins <pe...@elem.com>.
Michael Forbes wrote:
>Well, I've managed to make some significant progress: I got past that
>hang (apparently modperl was having problems with the URL b/c some of
>the values were being passed empty... i.e.,
>"stage=4&eqtype=All&cont=&restrictflags=12"... notice that cont has no
>value.
>
That sounds pretty bad. Maybe you should go back to mod_perl 1.3, which
definitely does not have problems with that.
>My next problem, which took four hours to track down, is that it turns
>out that mod_perl is choking on null values being retrieved from MySQL.
>I'm using DBI for the interface, and the actual fetch_row is performing
>exactly the way it should... but when it tries to do anything with my
>scalar once it has a null in it, it just chokes & sits there until it
>times out.
>
Are you using the pre-fork MPM? If not, do you know if your DBD driver
is threadsafe?
- Perrin
Re: hangs on $ENV{'QUERY_STRING'}
Posted by Michael Forbes <mf...@suscom.net>.
Well, I've managed to make some significant progress: I got past that
hang (apparently modperl was having problems with the URL b/c some of
the values were being passed empty... i.e.,
"stage=4&eqtype=All&cont=&restrictflags=12"... notice that cont has no
value.
At any rate, I solved that problem by forcing the form that passes the
information in to always have at least a bare minimum of data in each
field... and it seems to be working.
My next problem, which took four hours to track down, is that it turns
out that mod_perl is choking on null values being retrieved from MySQL.
I'm using DBI for the interface, and the actual fetch_row is performing
exactly the way it should... but when it tries to do anything with my
scalar once it has a null in it, it just chokes & sits there until it
times out. Is this a known bug? Is there a known fix for it, other
than ensuring I never have null values in my database?
Thanks,
Mike Forbes
mforbes@suscom.net
On Wed, 2002-10-30 at 17:53, Michael Forbes wrote:
> My apologies in advance if this is something that's been described &
> solved before... I can't seem to find the answer in archival searches
> (maybe I'm just using the wrong terms).
>
> At any rate, I have a fairly large script that I wrote when operating
> under Apache 1.3, perl 5.8.0, Redhat 7.3. I'm now running Apache 2.0,
> perl 5.8.0, and Redhat 8.0... and it stopped working when I performed
> the upgrade.
>
>
> Anywhere, what's happening is that the code below this paragraph is just
> hanging...(on the second line, I've inserted a few "print
> 'debug<BR>\n';" lines in the real thing to make sure.) it does finally
> time out, without producing any output.
>
> here's the relevant code:
>
> $pass = "/cgi-bin/plaintextresult.cgi?$ENV{'QUERY_STRING'}";
>
> print "<TD WIDTH='33%' ALIGN='CENTER' BGCOLOR='#222222'><A
> HREF=\"$pass\" target='printerfriendly'>Plain text version</A></TD>\n";
>
>
>
> Thanks in advance, and again, sorry if this is a FAQ, I just couldn't
> find the answer anywhere.
>
> -Mike Forbes
> mforbes@suscom.net
>
>
Re: hangs on $ENV{'QUERY_STRING'}
Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Thu, 2002-10-31 at 06:53, Michael Forbes wrote:
> My apologies in advance if this is something that's been described &
> solved before... I can't seem to find the answer in archival searches
> (maybe I'm just using the wrong terms).
>
> At any rate, I have a fairly large script that I wrote when operating
> under Apache 1.3, perl 5.8.0, Redhat 7.3. I'm now running Apache 2.0,
> perl 5.8.0, and Redhat 8.0... and it stopped working when I performed
> the upgrade.
If you are using mod_perl 1.99_05, the one shipped with RH8.0 and there
has been at least one known $ENV bug resolved since then. That fix
hasn't made it into a release yet. I would suggest you try building
mod_perl from source first and see if you still have the same problem.
If so you can either give a shot at the current CVS mod_perl or try and
apply this patch :
---------------------
PatchSet 1598
Date: 2002/10/22 02:42:03
Author: dougm
Log:
fix delete $ENV{$key} bug
Members:
Changes:1.55->1.56
src/modules/perl/modperl_env.c:1.25->1.26
src/modules/perl/modperl_env.h:1.12->1.13
src/modules/perl/modperl_perl_global.c:1.14->1.15
t/response/TestModperl/env.pm:1.2->1.3
Index: Changes
===================================================================
RCS file: /home/cvspublic/modperl-2.0/Changes,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -I'$Id' -I'$Revision' -u -r1.55 -r1.56
--- Changes 21 Oct 2002 20:21:33 -0000 1.55
+++ Changes 22 Oct 2002 02:42:03 -0000 1.56
@@ -10,6 +10,8 @@
=item 1.99_08-dev
+fix delete $ENV{$key} bug
+
fix parse_args compat method to support non-ascii characters
[Walery Studennikov <de...@sama.ru>]
Index: src/modules/perl/modperl_env.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_env.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -I'$Id' -I'$Revision' -u -r1.25 -r1.26
--- src/modules/perl/modperl_env.c 1 Jun 2002 23:42:07 -0000 1.25
+++ src/modules/perl/modperl_env.c 22 Oct 2002 02:42:03 -0000 1.26
@@ -15,6 +15,7 @@
else {
SV *sv = newSVpv(elt->val, 0);
hv_store(hv, elt->key, klen, sv, FALSE);
+ modperl_envelem_tie(sv, elt->key, klen);
svp = &sv;
}
@@ -143,8 +144,10 @@
modperl_env_untie(mg_flags);
while (ent->key) {
+ SV *sv = newSVpvn(ent->val, ent->vlen);
hv_store(hv, ent->key, ent->klen,
- newSVpvn(ent->val, ent->vlen), ent->hash);
+ sv, ent->hash);
+ modperl_envelem_tie(sv, ent->key, ent->klen);
ent++;
}
Index: src/modules/perl/modperl_env.h
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_env.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -I'$Id' -I'$Revision' -u -r1.12 -r1.13
--- src/modules/perl/modperl_env.h 30 May 2002 23:35:02 -0000 1.12
+++ src/modules/perl/modperl_env.h 22 Oct 2002 02:42:03 -0000 1.13
@@ -11,6 +11,9 @@
#define modperl_env_tie(mg_flags) \
MP_magical_tie(ENVHV, mg_flags)
+#define modperl_envelem_tie(sv, key, klen) \
+ sv_magic(sv, Nullsv, 'e', key, klen)
+
void modperl_env_hash_keys(void);
void modperl_env_clear(pTHX);
Index: src/modules/perl/modperl_perl_global.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_perl_global.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -I'$Id' -I'$Revision' -u -r1.14 -r1.15
--- src/modules/perl/modperl_perl_global.c 15 Nov 2001 01:25:00 -0000 1.14
+++ src/modules/perl/modperl_perl_global.c 22 Oct 2002 02:42:03 -0000 1.15
@@ -170,11 +170,56 @@
*avcv->av = avcv->origav;
}
+/*
+ * newHVhv is not good enough since it does not copy magic.
+ * XXX: 5.8.0+ newHVhv has some code thats faster than hv_iternext
+ */
+static HV *copyENV(pTHX_ HV *ohv)
+{
+ HE *entry, *hv_eiter;
+ I32 hv_riter;
+ register HV *hv;
+ STRLEN hv_max = HvMAX(ohv);
+ STRLEN hv_fill = HvFILL(ohv);
+
+ hv = newHV();
+ while (hv_max && hv_max + 1 >= hv_fill * 2) {
+ hv_max = hv_max / 2; /* Is always 2^n-1 */
+ }
+
+ HvMAX(hv) = hv_max;
+
+ if (!hv_fill) {
+ return hv;
+ }
+
+ hv_riter = HvRITER(ohv); /* current root of iterator */
+ hv_eiter = HvEITER(ohv); /* current entry of iterator */
+
+ hv_iterinit(ohv);
+ while ((entry = hv_iternext(ohv))) {
+ SV *sv = newSVsv(HeVAL(entry));
+ modperl_envelem_tie(sv, HeKEY(entry), HeKLEN(entry));
+ hv_store(hv, HeKEY(entry), HeKLEN(entry),
+ sv, HeHASH(entry));
+ }
+
+ HvRITER(ohv) = hv_riter;
+ HvEITER(ohv) = hv_eiter;
+
+ hv_magic(hv, Nullgv, 'E');
+
+ TAINT_NOT;
+
+ return hv;
+}
+
static void
modperl_perl_global_gvhv_save(pTHX_ modperl_perl_global_gvhv_t *gvhv)
{
- U32 mg_flags;
HV *hv = GvHV(gvhv->gv);
+#if 0
+ U32 mg_flags;
MAGIC *mg = SvMAGIC(hv);
/*
@@ -201,6 +246,9 @@
/* XXX: maybe newHVhv should do this? */
hv_magic(gvhv->tmphv, Nullgv, mg->mg_type);
}
+#else
+ gvhv->tmphv = copyENV(aTHX_ hv);
+#endif
gvhv->orighv = hv;
GvHV(gvhv->gv) = gvhv->tmphv;
Index: t/response/TestModperl/env.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestModperl/env.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -I'$Id' -I'$Revision' -u -r1.2 -r1.3
--- t/response/TestModperl/env.pm 11 Apr 2002 11:08:44 -0000 1.2
+++ t/response/TestModperl/env.pm 22 Oct 2002 02:42:03 -0000 1.3
@@ -7,13 +7,14 @@
use APR::Table ();
use Apache::Test;
+use Apache::TestUtil;
use Apache::Const -compile => 'OK';
sub handler {
my $r = shift;
- plan $r, tests => 20;
+ plan $r, tests => 20 + keys(%ENV);
my $env = $r->subprocess_env;
@@ -59,6 +60,13 @@
ok $ENV{SERVER_SOFTWARE};
ok $env->get('SERVER_SOFTWARE');
+
+ #Make sure each key can be deleted
+
+ for my $key (sort keys %ENV) {
+ eval { delete $ENV{$key}; };
+ ok t_cmp('', $@, $key);
+ }
Apache::OK;
}
>
> Anywhere, what's happening is that the code below this paragraph is just
> hanging...(on the second line, I've inserted a few "print
> 'debug<BR>\n';" lines in the real thing to make sure.) it does finally
> time out, without producing any output.
>
> here's the relevant code:
>
> $pass = "/cgi-bin/plaintextresult.cgi?$ENV{'QUERY_STRING'}";
>
> print "<TD WIDTH='33%' ALIGN='CENTER' BGCOLOR='#222222'><A
> HREF=\"$pass\" target='printerfriendly'>Plain text version</A></TD>\n";
>
>
>
> Thanks in advance, and again, sorry if this is a FAQ, I just couldn't
> find the answer anywhere.
>
> -Mike Forbes
> mforbes@suscom.net
>
>