Can't upgrade that kind of scalar ...

2000-03-30 Thread Doug MacEachern

fyi...

Index: Changes
===
RCS file: /home/cvs/modperl/Changes,v
retrieving revision 1.445
diff -u -u -r1.445 Changes
--- Changes 2000/03/30 00:44:39 1.445
+++ Changes 2000/03/30 19:35:12
@@ -10,6 +10,11 @@
 
 =item 1.22_01-dev
 
+reset the stack pointer after calling perl_require_module() in
+perl_call_handler().  this fix will most likely cure the reports of
+"Can't upgrade that kind of scalar at ..."
+[Ben Cottrell <[EMAIL PROTECTED]>]
+
 workaround use of Perl api functions that are no longer public with
 Perl 5.6.0 + win32, thanks to Randy Kobes for spotting
 
Index: src/modules/perl/mod_perl.c
===
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.110
diff -u -u -r1.110 mod_perl.c
--- src/modules/perl/mod_perl.c 2000/03/30 19:34:13 1.110
+++ src/modules/perl/mod_perl.c 2000/03/30 19:35:25
@@ -1557,6 +1557,7 @@
if(stash) /* check again */
is_method = perl_handler_ismethod(stash, method);
 #endif
+   SPAGAIN; /* reset stack pointer after require() */
}

if(!is_method && !defined_sub) {




Can't upgrade that kind of scalar

2000-02-12 Thread Ed Loehr

Aside from gdb, any fishing tips on how to track this fatal problem
down?

Can't upgrade that kind of scalar at XXX line NN...

Happens intermittently, often on a call to one of these (maybe the
first access of $r?):

$r->server->server_hostname()
$r->connection->remote_ip()

I've tried turning off PerlFreshRestart, have _totally_ clean output
from 'use diagnostics', reviewed The Guide, 'perldoc perldiag', FAQ,
deja.com, swarthmore, removed /o, used Carp::cluck, handled global
vars with 'use vars qw(...)'...

Config:  apache 1.3.9, mod_perl 1.21, mod_ssl 2.4.9, openssl 0.9.4,
perl 5.005_03, DBI 1.13 (no Apache::DBI), DBD::Pg 0.92, Linux
2.2.12-20smp (RH 6.1)...



Can't upgrade that kind of scalar (and more)

2000-02-04 Thread Ed Loehr

I've scoured deja.com, FAQs, modperl list archives at 
forum.swarthmore.edu, 'perldoc mod_perl_traps', experimented ad
nauseum 
for 4 days now... this modperl newbie is missing something
important...

Lasting gratitude and a check in the mail for dinner on me to any of
you
who can offer any tips/help which unlock this riddle for me...

Cheers,
Ed Loehr

SYMPTOMS...
---
Spurious errors in my error_log with increasingly nasty consequences:

    Can't upgrade that kind of scalar at XXX line NN...
Not a CODE reference at XXX line NN...
Modification of a read-only value attempted at XXX line NN...
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar during global destruction.
Attempt to free unreferenced scalar at XXX line NN...

Once upon a time, the server was fully functional even with these
occasional error messages (which is why I ignored them originally).
Now, they are frequent showstoppers, causing requests to fail
altogether with 500 errors and occasional segfaults...

I'm lumping these together because I suspect they are all related.
In any case, the severest of these at present seems to be the

    Can't upgrade that kind of scalar at XXX line NN...

message, which causes the request to fail and seems to foul up that
child for the rest of its life.


FAILED REMEDIES...
--
- Turned off PerlFreshRestart
- Got rid of '$| = 1;'
- Got rid of #!/usr/bin/perl -w (!!)
- Check 'use diagnostics' output
- Got rid of string regex optimization flags ( $key =~
m/^xyz/o )
- Replaced use of 'apachectl restart' with
stop-sleep3-startssl;
- use Carp ();  local $SIG{__WARN__} = \&Carp::cluck;
- Changed global all instances of global 'my $var = 0' to
'use vars qw($var);  $var = 0;'
- Commented out Apache::Registry
(Most of these are just suggestions I found during my hunt...)

CONFIGURATION...

(detailed config dumps below)
mod_perl 1.21 (*NOT* Apache::StatINC)
mod_ssl 2.4.9
openssl 0.9.4
perl 5.005_03
DBI 1.13 (*NOT* using Apache::DBI)
DBD::Pg 0.92
Apache 1.3.9 (*VERY* lightly loaded)
Linux 2.2.12-20smp (RH 6.1), 1Gb RAM, RAID 5 (*lots* of free
mem)
Dual PII 450 cpus
Using modified TicketMaster scheme from Eagle book

OBSERVATIONS...
---
I'm convinced the code referenced by the error msgs (XXX line NN) is
almost at random; typically code that's worked flawlessly before
(sometimes my code, often not).  I suspect the line numbers in the
error msg may be screwed up.  #line did not clarify things.

If I rearrange my code, I have been able to make the error "move" to
another module (eg., from Exporter.pm to CGI.pm).  Smell like a stack
corruption problem?  Currently, the first unsuccessful statement is:

# ($r is the usual apache request object)
return ($retval,$msg)
unless $ticket{'ip'} eq
$r->connection->remote_ip;


In -X mode, once the server process hits one of these, it can no
longer
serve any modperl-generated page without a 500 error, occasionally
segfaulting in the process.

This also happens on both production and development server in
slightly
different manifestations (with slightly different httpd.conf files).

Other change factors that may or may not be related:  new firewall
rules,
increased number of open file handles (echo 8192 >
/proc/sys/file-max),
increased load, RAM upgrade, numerous modperl app src code changes,
added
more use of Time::HiRes to other modules, new SSL certificate, and
more...

Finally, totally commenting out my incarnation of the TicketMaster
scheme
from the Eagle book (cookie-based passworded sessions) *seems* to
remove
the problem, but it's a moving target so I'm not sure of that yet. 
Have
been unable to determine what it might be within TicketMaster that is
causing the problem.

NEXT STEPS...
-
Try removing Logger.pm from Apache::Ticket*
Whittle down until minimal set produces error?
Autoload troubles?
Find/try MacEachern's Apache::Leak?  Hunting XS errors?
Apache::Vmonitor?
Relying on $_ in foreach loops?
SSL Certificate differences?
Dreaded Last Step: setup debugger and chase ...

# /usr/local/apache_ssl/bin/httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_access.c
  mod_auth.c
  mod_setenvif.c
  mod_ssl.c
  mod_perl.c

# /usr/local/apache_ssl/bin/httpd -V
Server version: Apache/1.3.9 (Unix)
Server built:   Dec  9 1999 11:40