Re: Preloading DBI crashes Apache

2003-02-25 Thread Dan Brosemer
Here's the thread to date:
http://marc.theaimsgroup.com/?l=apache-modperl&m=104586287823510&w=2

On Sun, Feb 23, 2003 at 10:27:22AM -0500, Dan Brosemer wrote:
> On Sun, Feb 23, 2003 at 04:35:39AM -0800, Ask Bjoern Hansen wrote:
> > > Hi.  I'm new here, and hoping someone can help me.  I've installed the
> > > latest -current version of OpenBSD, and loaded mod_perl as a DSO.  That gets
> > > me Apache 1.3.27, Perl 5.8.0, and mod_perl 1.27.

The plot thickens.  Loading mod_perl statically gets rid of this problem.
Even with otherwise-identical configure arguments.

Yet, the DSO mod_perl works fine except when I preload DBI.

I'm _quite_ confused.  I'd really like the DSO method to work, as then I
wouldn't have to modify the OpenBSD source tree (any more than I normally
do, anyway).  Does anyone have suggestions?

Even pointers for where in the code to look would be much appreciated.

TIA.

-Dan

-- 
"Burnished gallows set with red
 Caress the fevered, empty mind
 Of man who hangs bloodied and blind
 To reach for wisdom, not for bread."  -- Deoridhe Grimsdaughter


Re: Help: Can't coerce GLOB to string...

2003-02-25 Thread Stas Bekman
Kurt George Gjerde wrote:
Hi,

I get a "Can't coerce GLOB to string"-error for every new thread that is
started (mp2). I have no idea why this happens (or even what this error
actually means).
The module is included below (line producing the error is marked "ERROR
HERE"). Error happens for every new thread (on the first request).
When running ApacheBench  ab -c 3 -n 100 http://...  I get 3 errors and 97
OKs.
[...]

use threads;
use threads::shared;
why do you need to load threads? Do you plan to spawn your own threads?

[...]

  ### PARSE DOCUMENT
  my $document;
  eval {
$document = $xmlParser->parse_file($documentFilename);
  };
  if ($@) {
return error($r,'Error parsing XML document',$@);
  }
[...]
  ### TRANSFORM
  my $results;
  eval {
$results = $stylesheet->transform($document);   ### <--- ERROR HERE
It's expecting a scalar as an argument, right? could it be that $document is 
not a scalar? try to print ref($document)?

[...]
[Tue Feb 25 16:04:04 2003] [error] [xslTransformer] Error transforming
document - Can't coerce GLOB to string in entersub at
E:/data/www/perlLib/MyApache/XSLTransformer.pm line 74.
[tid=APR::OS::Thread=SCALAR(0x1205be4)|reqno=1|errno=1]


--

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [MP2] Apache::Reload date bug

2003-02-25 Thread Stas Bekman
Ron Savage wrote:
On Tue, 25 Feb 2003 09:40:05 +1100, Stas Bekman wrote:


And what your error_log says?


Nothing is output to the error_log.
Have you tried the current mod_perl cvs?

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: sanity check problem: Help installingmod_perl1.27andapache1.3.27

2003-02-25 Thread Charlie Smith



Ged,
 
attached are the source files I had to modify to get the mod_perl stuff to 
compile with Apache.
TestCompile
ldopts
 
The TestCompile routine had to be modified to remove the LIBS1 on line 
248.
This goes into the apache 1.3.27 distribution under 
src/helpers/TestCompile.  Maybe you or someone else could help 
code the test for an OS in this shell file. I left this out, so the user 
will have to use the modified file rather than
the original.
 
I modified ldopts file, which is included in both the mod_perl 
distribution and the apache distribution, under 
.../src/modules/perl/ldopts
I modified this file to check the OS before removing the -Wl  
parameter from the returned opts.
 
What is procedure to get these put in as patch?
 
Thanks,
Charlie Smith>>> "Ged Haywood" 
<[EMAIL PROTECTED]> 02/24/03 04:57PM >>>Hi 
Charlie,On Mon, 24 Feb 2003, Charlie Smith wrote:> Ok.  
I'll give it a whack or hack or whatever you want to call it.  Where 
are> the Wl flags loaded from for the mod_perl stuff?Actually 
they're from the Apache source, the mod_perl configuration may hack them.The 
tool I use most for poking around in sources is 'grep'...hurricane:~$ 
>>> grep -r Wl 
/home/ged/src/apache_1.3.27/*[snip,snip]/home/ged/src/apache_1.3.27/htdocs/manual/programs/apxs.html: 
-Wc,compiler-flags 
] [ 
-Wl,linker-flags 
] files 
.../home/ged/src/apache_1.3.27/htdocs/manual/programs/apxs.html: 
-Wl,linker-flags/home/ged/src/apache_1.3.27/src/CHANGES:  
*) Allow special options -Wc,xxx and -Wl,xxx on APXS compile/link 
command./home/ged/src/apache_1.3.27/src/Configure:    
LDFLAGS_SHLIB_EXPORT="-Zlink=dynamic 
-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-E"/home/ged/src/apache_1.3.27/src/Configure:    
     
LDFLAGS_SHLIB_EXPORT="-Wl,-E"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-E"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/Configure:    
 
LDFLAGS_SHLIB_EXPORT="-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/Configure:    
   
LDFLAGS_SHLIB_EXPORT="-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-Blargedynsym"/home/ged/src/apache_1.3.27/src/Configure:    
    LDFLAGS_SHLIB_EXPORT="-Wl,-E 
-Wl,-B,deferred"/home/ged/src/apache_1.3.27/src/Configure:    
    LDFLAGS_SHLIB_EXPORT="-Wl,-E -Wl,-B,deferred 
-Wl,+s"/home/ged/src/apache_1.3.27/src/Configure:   
LDFLAGS_SHLIB_EXPORT="-Wl,-Bexport:\$(SRCDIR)/support/httpd.exp"/home/ged/src/apache_1.3.27/src/Configure:    
    
LDFLAGS_SHLIB_EXPORT="-Wl,-bE:\$(SRCDIR)/support/httpd.exp"/home/ged/src/apache_1.3.27/src/Configure:    
    LDFLAGS_SHLIB_EXPORT="-Zlink=dynamic 
-Wl,-Bexport"/home/ged/src/apache_1.3.27/src/modules/perl/mod_perl.config.sh:#replace 
-Wl args meant for cc with args for 
ld/home/ged/src/apache_1.3.27/src/modules/perl/mod_perl.config.sh:    
while ($ldopts =~ s/-Wl,(\S+)/$1/) 
{/home/ged/src/apache_1.3.27/src/support/apxs.8:.BI \-Wl, 
"linker-flags"/home/ged/src/apache_1.3.27/src/support/apxs.8:.BI \-Wl, 
"linker-flags"/home/ged/src/apache_1.3.27/src/support/apxs.pl:    
print STDERR 
"   
[-Wl,]  
...\n";/home/ged/src/apache_1.3.27/src/support/apxs.pl:    my 
($opt_Wl, $opt_L, 
$opt_l);/home/ged/src/apache_1.3.27/src/support/apxs.pl:    
foreach $opt_Wl (@opt_W) 
{/home/ged/src/apache_1.3.27/src/support/apxs.pl:    
$opt .= " $1" if ($opt_Wl =~ 
m|^\s*l,(.*)$|);/home/ged/src/apache_1.3.27/src/support/apxs.pl:    
$opt .= " 
-W$opt_Wl";/home/ged/src/apache_1.3.27/src/support/apxs:    
print STDERR 
"   
[-Wl,]  
...\n";/home/ged/src/apache_1.3.27/src/support/apxs:    my 
($opt_Wl, $opt_L, 
$opt_l);/home/ged/src/apache_1.3.27/src/support/apxs:    
foreach $opt_Wl (@opt_W) 
{/home/ged/src/apache_1.3.27/src/support/apxs:    
$opt .= " $1" if ($opt_Wl =~ 
m|^\s*l,(.*)$|);/home/ged/src/apache_1.3.27/src/support/apxs:    
$opt .= " -W$opt_Wl";hurricane:~$ >>> grep -r Wl 
/home/ged/src/mod_perl-1.27/*/home/ged/src/mod_perl-1.27/apaci/mod_perl.config.sh:#replace 
-Wl args meant for cc with args for 
ld/home/ged/src/mod_perl-1.27/apaci/mod_perl.config.sh:    
while ($ldopts =~ s/-Wl,(\S+)/$1/) 
{73,Ged.

--
This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed.


==


TestCompile
Description: Binary data


ldopts
Description: Binary data


Re: Table/row locking with Apache::Session::Mysql /Apache::Session::Flex

2003-02-25 Thread md

--- Perrin Harkins <[EMAIL PROTECTED]> wrote:

> It would be.  Frankly, there is no value to the kind
> of mutual exclusion 
> that the Apache::Session locking provides in a
> typical web application. 
>   If you use the null locker you will still get
> atomic updates, but you 
> will have the possibility of someone opening up two
> browser windows, 
> hitting submit in both, and having the last save
> overwrite the values 
> from the first one, possibly losing some changes. 
> In most web apps, 
> that is not a big problem.

We talked about this, but in our case, I don't believe
this will be an issue.

> Note that this could become a problem if you use
> sessions incorrectly by 
> putting tons of data in them.  Most of your data
> should have its own 
> normalized tables and persistence code.  Sessions
> are for storing tiny 
> little bits of data like the user's ID or some form
> data that from a 
> multi-page form that hasn't been committed yet.

We put almost nothing in the session other than the
user id. There are three apps sharing the same session
table, and I believe one app may put two or three
other things other than the user id (like current page
id and affiliate id...both which I should be able to
remove someday:)...but never-the-less, very little
data in the session. I've gotten most of my sessioning
information from this list (and you), so I believe we
are session correctly :)
 
> If you look at the actual contents of
> Apache::Session::MySQL, you'll see 
> that it's essentially just a config file.  There's
> no need to be 
> concerned about using Flex, but you could easilly
> code up your own 
> Apache::Session::MySQLNoLocks by changing a line in
> the current module.

That's what I figured and that's what I'm going to do.

Thanks again,
--
md

__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


Re: Table/row locking with Apache::Session::Mysql /Apache::Session::Flex

2003-02-25 Thread Perrin Harkins
md wrote:
Also, we'll soon be adding a substantial number of
users to our system and I wonder if it would be wise
to move away from the table locking that is currently
being used with Apache::Session::MySQL.
It would be.  Frankly, there is no value to the kind of mutual exclusion 
that the Apache::Session locking provides in a typical web application. 
 If you use the null locker you will still get atomic updates, but you 
will have the possibility of someone opening up two browser windows, 
hitting submit in both, and having the last save overwrite the values 
from the first one, possibly losing some changes.  In most web apps, 
that is not a big problem.

Note that this could become a problem if you use sessions incorrectly by 
putting tons of data in them.  Most of your data should have its own 
normalized tables and persistence code.  Sessions are for storing tiny 
little bits of data like the user's ID or some form data that from a 
multi-page form that hasn't been committed yet.

I'm looking at Apache::Session::Flex and setting
"Lock=>'Null'"...however, I get the impression from an
old email (see below) that Flex is for debugging only.
If you look at the actual contents of Apache::Session::MySQL, you'll see 
that it's essentially just a config file.  There's no need to be 
concerned about using Flex, but you could easilly code up your own 
Apache::Session::MySQLNoLocks by changing a line in the current module.

First, any benchmarks on what kind of load I can
realistically use with Apache::Session::MySQL?
It all depends on how much data you put in (lots of data in the session 
will slow things down) and how fast your database is.  At eToys we used 
a slightly hacked version of Apache::Session::DBI with Oracle and it 
handled more traffic than most sites will ever see.

- Perrin



Re: Table/row locking with Apache::Session::Mysql /Apache::Session::Flex

2003-02-25 Thread Cory 'G' Watson
On Tuesday, February 25, 2003, at 11:55  AM, md wrote:

We're using Apache::Session::MySQL (Apache::Session
1.54) and occassionaly see long lock times.
I had a similar problem a few months ago with 
Apache::Session::Postgres.  I occasionally had Apache processes hang, 
and a quick ps aux shows a stalled query on the sessions table.  I 
ended up dropping it for Apache::Session::File.
I'm looking at Apache::Session::Flex and setting
"Lock=>'Null'"...however, I get the impression from an
old email (see below) that Flex is for debugging only.
I've not seen the problems since I switched to Apache::Session::File, 
but I would much prefer using the Postgres module, as it complicates my 
user's installation.

Could the MySQL and Pg implementations have the same problem?

Cory 'G' Watson
http://gcdb.spleck.net


Table/row locking with Apache::Session::Mysql /Apache::Session::Flex

2003-02-25 Thread md
We're using Apache::Session::MySQL (Apache::Session
1.54) and occassionaly see long lock times. 

Also, we'll soon be adding a substantial number of
users to our system and I wonder if it would be wise
to move away from the table locking that is currently
being used with Apache::Session::MySQL.

I'm looking at Apache::Session::Flex and setting
"Lock=>'Null'"...however, I get the impression from an
old email (see below) that Flex is for debugging only.


First, any benchmarks on what kind of load I can
realistically use with Apache::Session::MySQL? Is
moving to Apache::Session::Flex a good choice (and
then we could also change the session table to
INNODB), or should I create my own
Apache::Session::MySQL-type module by changing Lock =>
'Null'?

I didn't see much discussion on this in the archives,
so if it is there, please point me to the thread...

Thanks...
--
> On Thu, 11 Oct 2001, Jeffrey W. Baker wrote:
>
>Regarding Flex, nobody uses it.  It is for debugging.
 >If you have a
>particular variant of Flex that you use all the time
>(very likely), you
>can code up a 6-line module to make a real
>implementation like all the
>other session modules.
>
>Flex is for debugging, period.



__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


Help: Can't coerce GLOB to string...

2003-02-25 Thread Kurt George Gjerde
Hi,

I get a "Can't coerce GLOB to string"-error for every new thread that is
started (mp2). I have no idea why this happens (or even what this error
actually means).

The module is included below (line producing the error is marked "ERROR
HERE"). Error happens for every new thread (on the first request).
When running ApacheBench  ab -c 3 -n 100 http://...  I get 3 errors and 97
OKs.

Very grateful if anyone care to look at this!

[Apache/2.0.43 (Win32) mod_perl/1.99_09-dev Perl/v5.8.0 DAV/2]


-- Here's the module --

package MyApache::XSLTransformer;

use strict;
use warnings FATAL=>'all', NONFATAL=>'redefine';

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);

use threads;
use threads::shared;

use XML::LibXML;
use XML::LibXSLT;

use APR::OS;

my $statRequestCount = 0;
my $statErrorCount = 0;


sub handler {
  my $r = shift;

  $statRequestCount++;

  $r->content_type('text/html');

  my $documentFilename = $ENV{SCRIPT_FILENAME};
  my $stylesheetFilename = $r->dir_config("xslTransformer_stylesheet");

  return 404 unless -e $documentFilename;

  my $xmlParser   = XML::LibXML->new();
  my $xsltParser  = XML::LibXSLT->new();

  ### PARSE DOCUMENT
  my $document;
  eval {
$document = $xmlParser->parse_file($documentFilename);
  };
  if ($@) {
return error($r,'Error parsing XML document',$@);
  }

  ### PARSE STYLESHEET DOCUMENT
  my $stylesheetDocument;
  eval {
$stylesheetDocument = $xmlParser->parse_file($stylesheetFilename);
  };
  if ($@) {
return error($r,'Error parsing XSL stylesheet document (XML)',$@);
  }

  ### PARSE STYLESHEET
  my $stylesheet;
  eval {
$stylesheet = $xsltParser->parse_stylesheet($stylesheetDocument);
  };
  if ($@) {
return error($r,'Error parsing XSL stylesheet (XSLT)',$@);
  }

  ### TRANSFORM
  my $results;
  eval {
$results = $stylesheet->transform($document);   ### <--- ERROR HERE
  };
  if ($@) {
return error($r,'Error transforming document',$@);
  }

  ### PRINT
  eval {
print $stylesheet->output_string($results);
  };
  if ($@) {
return error($r,'Error serializing transformed document',$@);
  }

  my $tid = APR::OS::thread_current();
  $r->log_error("[xslTransformer] OK
[tid=$tid|reqno=$statRequestCount|errno=$statErrorCount]");

  return Apache::OK;
}

sub error {
  my ($r,$title,$msg) = @_;

  $statErrorCount++;

  my $tid = APR::OS::thread_current();
  $r->log_error("[xslTransformer] $title - $msg
[tid=$tid|reqno=$statRequestCount|errno=$statErrorCount]");
  return 500;
}

1;


--- The exact error log entry is: ---

[Tue Feb 25 16:04:04 2003] [error] [xslTransformer] Error transforming
document - Can't coerce GLOB to string in entersub at
E:/data/www/perlLib/MyApache/XSLTransformer.pm line 74.
[tid=APR::OS::Thread=SCALAR(0x1205be4)|reqno=1|errno=1]




Thanks,
-Kurt.
__
kurt george gjerde <[EMAIL PROTECTED]>
intermedia uib, university of bergen

Working for bandwidth.



RE: Apache::Session and Postgres

2003-02-25 Thread Grant McLean
Perrin Harkins wrote:
> On Mon, 2003-02-24 at 07:09, Grant McLean wrote:
> > I get this error:
> > 
> >   Can't locate object method "get_lock_manager" via package
> >   "Apache::Session::Postgres"
> > 
> > And indeed, that method does not seem to be defined in any 
> > of the modules which Apache::Session::Postgres inherits from.
> 
> I don't see anything that calls that method anywhere in the
> Apache::Session distribution.  Either you have some code doing 
> it, or you have an old version.  You should be running the 1.54
> distribution.

Thanks for the advice.  I had installed 1.54 but must have had an 
old version lying around.  Deleting lib/Apache/Session* and
rerunning the make install fixed the problem.

Thanks again
Grant