Re: load/regression test builders, monitoring tools for mod_perl apps

1999-10-18 Thread Stas Bekman

> Does anyone know of any good open source test builders for
> regression/performance-testing a mod_perl app?
> 
> This is the essence of what I would want such a suite to do:
> RECORD:
> -set up a proxy server to forward HTTP requests to a mod_perl'd server.
> -capture all GET/POST requests from the client and log them to a file, along
> with the server's output. The server's output would be the 'master' copy.
> PLAYBACK (REGRESSION):
> -play back the GET/POST requests and capture the output. Compare the output
> against the master copy. Raise an error in the log file if the two differ.
> PLAYBACK (LOAD):
> -play back the GET/POST requests according to some load scheme to see how
> well the application holds up under load.
> 
> If this doesn't exist, I think it would be easy enough to write using LWP; I
> just don't want to duplicate anyone's efforts.

Not that I know of, but yes LWP should be a good solution. And I would be
interested in collaborating on testing this tool, if you choose to work on
it!

BTW, for client side based benchmarks see:
http://perl.apache.org/guide/performance.html#Tuning_the_Apache_s_configuratio

> I'd also be interested to know if anyone knows of any good webserver
> monitoring programs that could automatically kill spinning httpds, short of
> a CRON job. FYI-- I have encountered mystery spinning httpd's as well, but I
> have always been able to pin it down on bad/risk code or thrashing. At any
> rate, I still need to be able to kill spinning httpds should it come to
> that.

Yup,
http://perl.apache.org/guide/control.html#Monitoring_the_Server_A_watchdo
http://perl.apache.org/guide/control.html#Preventing_from_modperl_process_


___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: [SITE] the great redesign of 1999

1999-10-18 Thread Stas Bekman

> >I'm very excited about you picking the flag and actually doing the
> >redesign. Since modperl.sourcegarden.org is a sister site of
> >perl.apache.org, the two will be tighlty reconnected. We are going to
> >absorb some of the pages from the current mod_perl site. I'm talking about
> >3rd party modules, jobs, ISPs, success stories and other. We want to put
> >them into a DB with web admin interface, by using Jsmes' 'fresh'
> >application
> 
> We were planning to put a good deal of the stuff into a db too I think. I
> guess it doesn't matter too much if we have duplicated content as long as
> it is in sync. We will have to take into account what you are doing so that
> we can cross-link whenever it makes sense.

Of course it does matter not to have the stuff duplicated, since it's a
nightmare to keep 2 things in sync, but why should we doing that? I don't
see any reason... We wanted to do that to complement the current site, if
you are going to do that anyway, there is no reason, why we wouldn't put
our efforts to create other useful things...

Anyway, let's stop talking about "you" and "we", we are all "we" :) No
competition, only collaboration. James is working on this application,
which is in pretty good stage (James?), why in the world would you want to
write something else from scratch? James' tool will be able to index jobs,
ISPs, application, modules whatever... So I think that the best idea would
be to join James, and in a joint effort deliver it sooner, influencing on
the way the final set of features... But as always, I might be wrong, so
it's just an idea... I'm very delighted to know that you started to work
on the new site and I'm in no way would try to stop or provide
deconstructing thoughts :) 


___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: Apache::ASP

1999-10-18 Thread Stas Bekman

> Devarajan MN wrote:
> > 
> > Hi,
> >  I have to use Apache::ASP for a project of mine.
> > The client wants to have a java applet which will send
> > some information in an encrypted fashion to the ASP .
> > The ASP will have to recieve this encrypted
> > information and then send it to the apache server.
> > 
> > I want to know if this is possible. What should I be
> > doing to pass the information from the java applet to
> > my ASP in a secure manner? Do i need to use HTTPS
> > protocol ?
> > 
> 
> Yes, of course its possible.  This is perl we are
> talking about :)
> 
> To secure the data transfers I would do it under
> https, like any other client <-> http server connection.
> 
> Gunther Birznieks has written JavaCGIBridge  
> ( http://www.gunther.web66.com/JavaCGIBridge/ )
> 
> which seems to provide some nice glue for data communications
> between Java Applets & CGI type programs.  I have never
> used it, but would expect it to work with ASP scripts, since
> CGI code can be executed in ASP scripts just by wrapping 
> the code up in <% %>

I've used it to write a java chat client with backend mod_perl server -
works like a magic! and it adds only a few kbytes to the compressed jar 
of the applet...


___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



load/regression test builders, monitoring tools for mod_perl apps

1999-10-18 Thread Ed Park

Does anyone know of any good open source test builders for
regression/performance-testing a mod_perl app?

This is the essence of what I would want such a suite to do:
RECORD:
-set up a proxy server to forward HTTP requests to a mod_perl'd server.
-capture all GET/POST requests from the client and log them to a file, along
with the server's output. The server's output would be the 'master' copy.
PLAYBACK (REGRESSION):
-play back the GET/POST requests and capture the output. Compare the output
against the master copy. Raise an error in the log file if the two differ.
PLAYBACK (LOAD):
-play back the GET/POST requests according to some load scheme to see how
well the application holds up under load.

If this doesn't exist, I think it would be easy enough to write using LWP; I
just don't want to duplicate anyone's efforts.

I'd also be interested to know if anyone knows of any good webserver
monitoring programs that could automatically kill spinning httpds, short of
a CRON job. FYI-- I have encountered mystery spinning httpd's as well, but I
have always been able to pin it down on bad/risk code or thrashing. At any
rate, I still need to be able to kill spinning httpds should it come to
that.

cheers,
Ed



PerlHandler -> AUTH_REQUIRED?

1999-10-18 Thread Darko Krizic

This message was sent from Geocrawler.com by "Darko Krizic" <[EMAIL PROTECTED]>
Be sure to reply to that address.

I have a PerlHandler (content handler) like this:


SetHandler  perl-script
PerlHandler BSB::MyScript
PerlInitHandler Apache::StatINC
PerlSendHeader  Off


Now I want to return a AUTH_REQUIRED if the URI begins with "/admin/" and the user has 
not authenticated. I this basically possible or is it "too late", since the auth and 
authz stages passed already?

...darko


Geocrawler.com - The Knowledge Archive



Re: [SITE] the great redesign of 1999

1999-10-18 Thread Robin Berjon

At 22:00 16/10/1999 +0200, Stas Bekman wrote:
>After reworking the initial design based on the comments I've received,
>the next version was release at SourceGarden see
>http://modperl.sourcegarden.org/ - it's being created by Site::Builder -
>you can retrieve it from the garden's Safari pet:
>
>http://modperl.sourcegarden.org:5676/cvs/-/-/site_builder/

Thanks, I'll be looking into all this, I'm sure it'll help.

>I'm very excited about you picking the flag and actually doing the
>redesign. Since modperl.sourcegarden.org is a sister site of
>perl.apache.org, the two will be tighlty reconnected. We are going to
>absorb some of the pages from the current mod_perl site. I'm talking about
>3rd party modules, jobs, ISPs, success stories and other. We want to put
>them into a DB with web admin interface, by using Jsmes' 'fresh'
>application

We were planning to put a good deal of the stuff into a db too I think. I
guess it doesn't matter too much if we have duplicated content as long as
it is in sync. We will have to take into account what you are doing so that
we can cross-link whenever it makes sense.




.Robin
Radioactive cats have 18 half-lives.



PerlTransHandler

1999-10-18 Thread William Deegan

How can I change the environment variables that get passed to a perl
script running under Apache::Registry from a PerlTransHandler?

I'm using the PerlTransHandler to do a sort of dynamic mod_rewrite
functionality.

Thanks,
Bill

begin:vcard 
n:Deegan;William
tel;fax:650-638-7890
tel;work:650-638-7975
x-mozilla-html:FALSE
url:http://www.iescrow.com
org:iEscrow,Inc.
version:2.1
email;internet:[EMAIL PROTECTED]
title:Web Site Operations Manager
note:http://www.orangefood.com/baddog
adr;quoted-printable:;;1730 South Amphlett Blvd=0D=0ASuite 215;San Mateo;CA;94402;
x-mozilla-cpt:;18272
fn:William Deegan
end:vcard



Re: Apache::ASP

1999-10-18 Thread Joshua Chamas

Devarajan MN wrote:
> 
> Hi,
>  I have to use Apache::ASP for a project of mine.
> The client wants to have a java applet which will send
> some information in an encrypted fashion to the ASP .
> The ASP will have to recieve this encrypted
> information and then send it to the apache server.
> 
> I want to know if this is possible. What should I be
> doing to pass the information from the java applet to
> my ASP in a secure manner? Do i need to use HTTPS
> protocol ?
> 

Yes, of course its possible.  This is perl we are
talking about :)

To secure the data transfers I would do it under
https, like any other client <-> http server connection.

Gunther Birznieks has written JavaCGIBridge  
( http://www.gunther.web66.com/JavaCGIBridge/ )

which seems to provide some nice glue for data communications
between Java Applets & CGI type programs.  I have never
used it, but would expect it to work with ASP scripts, since
CGI code can be executed in ASP scripts just by wrapping 
the code up in <% %>

--Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NODEWORKS >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



mod_perl with APXS plus Raven equals segfault

1999-10-18 Thread Steve Snodgrass

I've been using mod_perl with Raven's SSL package for some time now, but I'm
building a refresh of our environment with new versions of everything and I
ran into trouble.  I decided to use APXS this time instead of building
mod_perl statically.  Everything compiled and installed fine but Apache
immediately segfaults on startup.  The details:

Sun Ultra Enterprise 3500
Solaris 7 (HW 5/99)
Apache 1.3.9 (built from Raven pre-patched source)
Raven SSL 1.4.1
mod_perl 1.21
perl 5.005_03
gcc 2.95.1 (regular Solaris ld, GNU ld is not even on the system)

I guess I can go back to compiling mod_perl statically, but it would be nice
to get this fixed.  Any thoughts?  Thanks.

-- 
Steve "Pheran" Snodgrass * [EMAIL PROTECTED] * FORE Systems Unix Administrator
Geek Code: GCS d? s: a- C++ US$ P+++ L+ w PS+ 5++ b++ DI+ D++ e++ r++ y+*
"What to do I find it hard to know/The road I walk is not the one I chose" -Yes



RE: hanging processes

1999-10-18 Thread Steve Reppucci


Hmmm.  On Friday night one of my servers (Solaris 5.6, modperl 1.21,
Apache 1.39) was hosed. Logging in to it, I found about 20 httpd children
spinning, eating cpu cycles.

I didn't dig into it, just killed the parent server (ungracefully) and
restarted, but mentioning it here in case this is something that's
happening to a bunch of us running Apache/modperl on Solaris.



On Mon, 18 Oct 1999, Eric Cholet wrote:

> On Monday, October 18, 1999 5:42 PM, Marc D. Spencer [SMTP:[EMAIL PROTECTED]] wrote:
> > Hi.
> > 
> >   I have an apache server (1.3.6/Solaris 5.6) running mod_perl/1.21.
> > 
> >   For it, I have a fairly complex handler involving several classes, some
> > of which bind to libraries (one of them is ImageMagick).
> > 
> >   The server is configured to only allow requests for this module, and does
> > not serve any static pages.
> > 
> >   At least once a day, I will find an http process monopolizing one of the
> > 4 CPU's in our production machine (E-450); server-status claims it's in W
> > mode (waiting for connection) but the log that our module generates
> > indicates it hangs at an arbitrary point within it's flow.
> 
> For what it's worth, I've been experiencing the same situation. Happens less
> often, but that may be just because I have less trafic. Mind that W mode is
> 'sending reply' which is consistent with the module being hung.
> I haven't raised this issue on the list because I haven't been able to track
> it down and therefore I assume it's a bug in my code. Since I do socket stuff
> I could very well be blocking on a system call.
> 
> 
> > 
> >   We have poured over the code, and over the FAQ's, etc, at the mod_perl
> > site, but have no ideas beyond a cron to kill these abhorrant processes
> > when their cume CPU time exceeds some level (not a great measure...we had
> > to set the threshold very high as to not kill happy processes).
> > 
> >   Can someone shed any light on what may be happening, or a better way to
> > monitor and kill these children?
> > 
> > Thanks, in advance.
> > Marc Spencer
> > www.kodak.com
> 
> --
> Eric
> 

=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=
Steve Reppucci   [EMAIL PROTECTED] |
Logical Choice Software  http://logsoft.com/ |
508/958-0183 Be Open |



Apache::ASP

1999-10-18 Thread Devarajan MN

Hi,
 I have to use Apache::ASP for a project of mine.
The client wants to have a java applet which will send
some information in an encrypted fashion to the ASP .
The ASP will have to recieve this encrypted
information and then send it to the apache server. 

I want to know if this is possible. What should I be
doing to pass the information from the java applet to
my ASP in a secure manner? Do i need to use HTTPS
protocol ?

Please help me. 

Regards,
Devarajan


   


__
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com



mod_perl/proxy setup -- ISP buffering?

1999-10-18 Thread Jonathan A. Marshall

Another question on the issue of slow (modem) connections and having a
lightweight front-end to the mod_perl servers...

A slow modem connection would typically exist between a client computer and
an ISP; the ISP would have a fast network connection to the Internet.  Are
there any ISPs that do significant buffering of webserver responses for
their slow clients?  If so, wouldn't this reduce the advantage of doing the
buffering within a server-side lightweight front-end to mod_perl?  How often
should I expect this behavior from ISPs?

If ISPs don't do this kind of buffering, why not?

Thanks,
--Jonathan Marshall

 --  Jonathan A. Marshall  --
--   Well Rounded Software, Inc.--
--   41 Lyons Road   (908) 766-2259 --
 --  Basking Ridge, NJ 07920-1917, USA   [EMAIL PROTECTED] --

On Mon, 18 Oct 1999, Stas Bekman wrote:
> Idealy, one of the big advantages proxy provides for mod_perl is downsteam
> buffering. What happens is that mod_perl immediately generates the output,
> hadles it to proxy to return to a slow user, which immediately allows to
> close a connection. So the first question is how big your proxy buffer,
> since if mod_perl cannot send it all to proxy it doesn't really helps.
> Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  




Re: KeepAlive in mod_perl/proxy setup is evil...

1999-10-18 Thread craig

On Mon, Oct 18, 1999 at 12:00:07PM +0200, Stas Bekman wrote:
> 
> [CC'ing this to modperl list, this is something of general interest and
> a good topic for an interesting thread]

:)

I'm not currently subscribed to this as I'm extremely new to mod_perl. I
hope people keep me on the cc list until my subscription comes through.

[snip]
> You are talking about KeepAlive... Hmm, I think you are right, I should
> have mentioned this point. Do you think the KeepAlive should be turned
> off? Since there is no actually need for this option (all the static
> objects are being served by a lighter process). But if the KeepAlive is
> on, mod_perl will keep the connection open, till it timeouts or
> terminated. So it breaks all the "improvements" down :(
> 
> If I'm not missing something, you've got a real case here. 

There are definite advantages to keep-alive from a tcp perspective since
fresh connections will incur not only the 3 way-TCP handshake but also be
penalised by slow-start. So while turning it off may help the memory usage
on the server, it will disadvantage the client from a network speed
perspective ... tricky.

One option I suppose would be for the proxy/accelerator to keep the
connection open to the client but make individual connections to the
server, read the response, buffer it for sending to the client and close
the server connection (making new connections to the server as required
by the client requests obviously). Given the speed of the network
connections I deal with, this may be a win but I'm only on day 3 of
playing with mod_perl things so it's hard to tell ;)

Cheers,

--Craig



setting cookies?

1999-10-18 Thread Wyman Eric Miles


System:

Solaris 2.6
Apache 1.3.9/mod_perl 1.19/gcc 2.8.1/perl-5.004.04

I'm using SecurID to authenticate for an Apache proxy server.  I've
written a little perl module that uses a username/tokencode returned by
basic auth to validate a user and return a session cookie.  The SecurID
auth works fine and I'm able to generate a cookie for the user.  

The problem is, I can't get the module to return the cookie to the browser
before the proxy request is completed.

Initially, I tried:

[...SecurID auth...]

$r -> header_out('Set-Cookie' => $cookie);
return OK;

That didn't seem to work (no cookie in the snoops, Netscape has no
knowledge of it).  So, I turned to sending back a redirect instead:

[...SecurID auth...]

my $req_uri = Apache::URI->parse($r, $r ->uri);
$r -> header_out('Location' => $req_uri);
$r -> header_out('Set-Cookie' => $cookie);
return REDIRECT;

Before any of this, I tried the TicketAccess example from the mod_perl
O'Reilly book but the circular nature of authenticating a proxy rendered
that unworkable.

My current solution is so close--I just need to get that cookie to the
browser and have it returned on each subsequent proxy request.  What am I
doing wrong?

Thanks!


Wyman Miles
Systems Administrator, Rice University, Texas.
(713) 737-5827, e-mail:[EMAIL PROTECTED], pager:[EMAIL PROTECTED]



Re: Apache::ASP - accessing Session data from Application

1999-10-18 Thread Joshua Chamas

Adi wrote:
> 
> I suppose I could do it all through an Application->{SessionID} structure,
> but then I wouldn't be using the Session object at all.  And I do have some
> locking going on, which would make this very unwise.  There could be serious
> bottleneck if everyone is just using Application, since Application->Lock
> locks the whole shebang.
> 
> >
> > > my $sessobj = $Application->Get_Session("87c6039a20a50a01000a054b547add4b");
> > > print $sessobj->{'foo'};
> > >
> > > That way I wouldn't have to go through all my code adding Session data to
> > > Application. :)  How hard would implementing such a method be?
> > >

I have added an $Application->GetSession($session_id) API
extension to Apache::ASP.  I'll send you my latest dev version
in a separate email.

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NODEWORKS >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



RE: hanging processes

1999-10-18 Thread Doug MacEachern

> >% gdb /usr/local/apache/bin/httpd $pid
> >(gdb) where
 
> Unfortunatly,
> 
> Bin there, did that...

what about attaching with gdb?




Re: weird mod_perl startup problems

1999-10-18 Thread Eugene Miretskiy

Doug MacEachern wrote:
> 
> > > > I would like to load the following modules at start up (I have them in 
>startup.perl file
> 
> > > >END failed--cleanup aborted.
> > > > END {
> > > > DBI->trace_msg("-> DBI::END\n", 2);  
>##LINE 311
> 
> wait, this happens at startup?  you must have mod_perl configured as a
> dso, notice in the ToDo file:
> - USE_DSO=1 --> END blocks are run at startup time
> 
> END blocks are normally not supposed to run until child_exit.
> could be something related to that, try linking static instead of dso,
> does the problem go away?

You were absolutelly right...
After recompiling apache/mod_perl w/out DSO, everything is working fine.
An interesting thing is that I had exactly the same setup on FreeBSD 3.2
(this problem poped up after upgrading to 3.3)



-- 
  Eugene Miretskiy <[EMAIL PROTECTED]>
  InVision, INC.  (516) 543-1000x219  
  http://www.invision.net



RE: new for embperl...

1999-10-18 Thread Jearanai Vongsaard

> > Starting httpd...   pid = 8057  ok
> >
> > Testing mod_perl mode...
> >
> > ascii...   8057:/usr/local/apache/bin/httpd: rld:
> > Fatal Error: attempted access to unresolvable symbol in
> > blib/arch/auto/HTML/Embperl/Embperl.so: mod_perl_sent_header
> 
> As long as "make test" did not work, we don't need to look at the
> configuration!
> 
> I already answered to that problem and thought you have solved this already.
> Please make sure that "make test" works without problems. I guess afterwards
> the rest will work also!
> 
> Here is what I wrote in my last mail:
> 
> 
> Apache does not export any symbols. You need to rebuild your Apache with
> symbols exported. Look in the FAQ for some hints.

I'm sorry that I misunderstood your mail last time. Do I have to reinstall
apache or both apache and mod_perl. I couldn't find the hints in the FAQ.
Could you please point me out where the document is located.

Thank you very much,
--apple
> 
> Gerald
> 
> 



RE: Embperl and Apache LogLevel configuration

1999-10-18 Thread Christian Gilmore

Gerald,

Nothing gets reported to the error log when those lines are commented out, no
matter apache's LogLevel setting. The entry in the logfile that I'm seeing is
apparently coming from the printing to stderr. I also have the same problem
under a simpler configuration on Solaris (no ssl, no added CFLAGS). I did very
standard things in the installation:

alice% pwd
/www/www/src/mod_perl-1.21
alice% perl Makefile.PL \
APACHE_SRC=../apache_1.3.9/src \
DO_HTTPD=1 \
USE_APACI=1 \
PREP_HTTPD=1 \
EVERYTHING=1
alice% make install

alice% pwd
/www/www/src/apache_1.3.9
alice% SSL_BASE=/usr/local/openssl-0.9.4 \
CC=cc CFLAGS="-O2 -DSGI -D__BIT_TYPES_DEFINED__" \
./configure --prefix=/www/www/apache \
--disable-rule=IRIXN32 \
--logfiledir=/www/www/apache/logs \
--sysconfdir=/www/www/apache/conf \
--datadir=/www/www/apache \
--enable-suexec --suexec-caller=www --suexec-userdir=cgi-bin \
--enable-module=proxy --enable-module=rewrite --enable-module=ssl \
--activate-module=src/modules/perl/libperl.a
alice% make install

alice% pwd
/www/www/src/HTML-Embperl-1.2b10
alice% perl Makefile.PL
Build with support for Apache mod_perl?(y/n) [y] y
Use ../apache_1.3.9/src as Apache source(y/n) [y] y
Will use /www/www/src/apache_1.3.9/src for Apache Headers
Apache Version Server version: Apache/1.3.9 (Unix)
 + found mod_ssl
Test start /www/www/src/apache_1.3.9/src/httpd
Test httpd will run as user www and group www
Test httpd will listen on port 8529
Found mod_perl  Version 1.21
Found LWP::UserAgent  Version 1.68
Found HTML::HeadParser  Version 2.08
Apache::Session not installed on this system
-> Disable tests for persistent data storage
Found CGI  Version 2.56
Checking if your kit is complete...
Looks good
Writing Makefile for HTML::Embperl
alice% make install


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Gerald Richter
> Sent: Monday, October 18, 1999 2:59 PM
> To: Christian Gilmore; 'ModPerl Mailing List (E-mail)'
> Subject: RE: Embperl and Apache LogLevel configuration
>
>
> >
> > apache-1.3.9
> > mod-ssl-2.4.2
> > OpenSSL-0.9.4
> > mod-perl-1.21
> > HTML-Embperl-1.2b10
> > Irix-6.5
> >
>
> That should work. Could you search in the file epmain.c, in function
> LogError the line
>
> log_error (sText, r -> pApacheReq -> server) ;
>
> and the line
>
>fprintf (stderr, "%s\n", sText) ;
>
> and comment both out:
>
> /* log_error (sText, r -> pApacheReq -> server) ; */
>
> and
>
> /*   fprintf (stderr, "%s\n", sText) ; */
>
>
> Now rebuild Embperl. Does this change anything?
>
> Gerald
>
> > Regards,
> > Christian
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > > Behalf Of Gerald Richter
> > > Sent: Monday, October 18, 1999 2:48 PM
> > > To: Christian Gilmore; ModPerl Mailing List (E-mail)
> > > Subject: RE: Embperl and Apache LogLevel configuration
> > >
> > >
> > > >
> > > > I've my apache loglevel currently set to crit, but
> Embperl errors
> > > > such as the
> > > > one below continue to show up in my error_log.
> > > >
> > > > [3396892]ERR:  30: Line 1: Not found
> > > /usr/lund/wwwfiles/wnetdoc/map.c.html
> > > >
> > > > Only if my LogLevel is set to error or a more verbose level
> > > > should this error
> > > > find its way to the log file, yes? Also, where are the apache
> > > > timestamp and
> > > > error-type in Embperl-generated errors?
> > > >
> > >
> > > Which version of Embperl and Apache you are using?
> > >
> > > In my logfiles I see the timestamp and Embperl writes to the
> > > logfile with
> > > APLOG_ERR as level.
> > >
> > > Gerald
> > >
> > >
> >
>
>



RE: hanging processes

1999-10-18 Thread Tobias Hoellrich

Marc,

this is mighty weird. truss usually reports the last call the application
made, if it is really hanging (poll() and select() and that kind of stuff).
I've never seen just printing "nothing".
If you're on Solaris, have you tried the /usr/proc/bin stuff. "pflags
[pid]", "pstack [pid]" ?

Tobias

At 03:13 PM 10/18/99 -0400, Marc D. Spencer wrote:
>Unfortunatly,
>
>Bin there, did that...
>
>truss doesn't report anything back...it just sits.  it seems truely hung.
>Yet at the same time, if you watch it in top, it's eating CPU.
>
>server-status:
>
> 1-3 20804 0/0/12196 W 15.33 1502 0 0.0 0.00 117.71  12.8.233.82
>iserv.kodak.com
>
>from top:
>
>20804 -user-1  100  525M  220M cpu2   24:37 24.04% httpd
>
>24% of a 4 cpu system is ~100% of cpu2... :)
>
>
>"0201: Keyboard Error.  Press F1 to continue."
>  -- IBM PC-XT Rom, 1982
>\---\
> \ Marc D. Spencer   Any opinions expressed here \
>  \ Applications Engineer  are my own and are not \
>   \ Network Servicesnecessarily those of my   \
>\ Eastman Kodak Companyemployer.\
> \---\




RE: hanging processes

1999-10-18 Thread Marc D. Spencer

At 12:30 PM -0400 10/18/99, Doug MacEachern wrote:
>given the process pid, there are two ways to find out where it's hanging:
>
>depending on os:
>% truss -p $pid
> or
>% strace -p)
>
>and
>
>% gdb /usr/local/apache/bin/httpd $pid
>(gdb) where
>
>-Doug

Unfortunatly,

Bin there, did that...

truss doesn't report anything back...it just sits.  it seems truely hung.
Yet at the same time, if you watch it in top, it's eating CPU.

server-status:

 1-3 20804 0/0/12196 W 15.33 1502 0 0.0 0.00 117.71  12.8.233.82
iserv.kodak.com

from top:

20804 -user-1  100  525M  220M cpu2   24:37 24.04% httpd

24% of a 4 cpu system is ~100% of cpu2... :)


"0201: Keyboard Error.  Press F1 to continue."
  -- IBM PC-XT Rom, 1982
\---\
 \ Marc D. Spencer   Any opinions expressed here \
  \ Applications Engineer  are my own and are not \
   \ Network Servicesnecessarily those of my   \
\ Eastman Kodak Companyemployer.\
 \---\



Re: Apache::ASP - accessing Session data from Application

1999-10-18 Thread Adi

Joshua Chamas wrote:
> > Do you think there are any advantages to adding a "Get_Session" method to
> > $Application that will return a reference to the Session object with a given
> > ID?  e.g.
> >
> 
> Only if you do.  Why would you want to do such a thing ?  There
> may be other ways around your problem.

Well, I am writing a session monitor application, which monitors what's
happening in all the user sessions.  I want it to not only see what's going
on, but fix things for the user.  As in the context of a user(newbie) and
administrator.  I want the administrator to be able to physically fix the
things that the user has broken- in other words, have write access to
arbitrary user Sessions.

I suppose I could do it all through an Application->{SessionID} structure,
but then I wouldn't be using the Session object at all.  And I do have some
locking going on, which would make this very unwise.  There could be serious
bottleneck if everyone is just using Application, since Application->Lock
locks the whole shebang.


> 
> > my $sessobj = $Application->Get_Session("87c6039a20a50a01000a054b547add4b");
> > print $sessobj->{'foo'};
> >
> > That way I wouldn't have to go through all my code adding Session data to
> > Application. :)  How hard would implementing such a method be?
> >
> 
> Not terribly.
> 

Could I do it?  It seems this is the best solution for my problem.  Do you
think there's a better way?

- Adi



RE: Embperl and Apache LogLevel configuration

1999-10-18 Thread Gerald Richter

>
> apache-1.3.9
> mod-ssl-2.4.2
> OpenSSL-0.9.4
> mod-perl-1.21
> HTML-Embperl-1.2b10
> Irix-6.5
>

That should work. Could you search in the file epmain.c, in function
LogError the line

log_error (sText, r -> pApacheReq -> server) ;

and the line

   fprintf (stderr, "%s\n", sText) ;

and comment both out:

/* log_error (sText, r -> pApacheReq -> server) ; */

and

/*   fprintf (stderr, "%s\n", sText) ; */


Now rebuild Embperl. Does this change anything?

Gerald

> Regards,
> Christian
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Gerald Richter
> > Sent: Monday, October 18, 1999 2:48 PM
> > To: Christian Gilmore; ModPerl Mailing List (E-mail)
> > Subject: RE: Embperl and Apache LogLevel configuration
> >
> >
> > >
> > > I've my apache loglevel currently set to crit, but Embperl errors
> > > such as the
> > > one below continue to show up in my error_log.
> > >
> > > [3396892]ERR:  30: Line 1: Not found
> > /usr/lund/wwwfiles/wnetdoc/map.c.html
> > >
> > > Only if my LogLevel is set to error or a more verbose level
> > > should this error
> > > find its way to the log file, yes? Also, where are the apache
> > > timestamp and
> > > error-type in Embperl-generated errors?
> > >
> >
> > Which version of Embperl and Apache you are using?
> >
> > In my logfiles I see the timestamp and Embperl writes to the
> > logfile with
> > APLOG_ERR as level.
> >
> > Gerald
> >
> >
>



RE: new for embperl...

1999-10-18 Thread Gerald Richter

> Starting httpd...   pid = 8057  ok
>
> Testing mod_perl mode...
>
> ascii...   8057:/usr/local/apache/bin/httpd: rld:
> Fatal Error: attempted access to unresolvable symbol in
> blib/arch/auto/HTML/Embperl/Embperl.so: mod_perl_sent_header

As long as "make test" did not work, we don't need to look at the
configuration!

I already answered to that problem and thought you have solved this already.
Please make sure that "make test" works without problems. I guess afterwards
the rest will work also!

Here is what I wrote in my last mail:


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On
Behalf Of Gerald Richter
Sent: Monday, October 04, 1999 9:11 PM
To: Jearanai Vongsaard
Cc: [EMAIL PROTECTED]
Subject: RE: Embperl make test need help...


>
> Thank you very much. I got it run already. I can start my http but I still
> get some errors.  What should I do?  Can I ignore these errors or I have
> to fix them? --Thanks
>
> ...
> Use of uninitialized value at (eval1218) line 1.
> Starting httpd...  pid = 5764 ok
>
> Testing mod_perl mode...
>
> ascii...
> 5764:/opt/local/download/apache_1.3.9/src/httpd: rld: Fatal Error:
> attempted access to unresolvable symbol in

Apache does not export any symbols. You need to rebuild your Apache with
symbols exported. Look in the FAQ for some hints.

Gerald




RE: Embperl and Apache LogLevel configuration

1999-10-18 Thread Christian Gilmore

apache-1.3.9
mod-ssl-2.4.2
OpenSSL-0.9.4
mod-perl-1.21
HTML-Embperl-1.2b10
Irix-6.5

Regards,
Christian

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Gerald Richter
> Sent: Monday, October 18, 1999 2:48 PM
> To: Christian Gilmore; ModPerl Mailing List (E-mail)
> Subject: RE: Embperl and Apache LogLevel configuration
> 
> 
> >
> > I've my apache loglevel currently set to crit, but Embperl errors
> > such as the
> > one below continue to show up in my error_log.
> >
> > [3396892]ERR:  30: Line 1: Not found 
> /usr/lund/wwwfiles/wnetdoc/map.c.html
> >
> > Only if my LogLevel is set to error or a more verbose level
> > should this error
> > find its way to the log file, yes? Also, where are the apache
> > timestamp and
> > error-type in Embperl-generated errors?
> >
> 
> Which version of Embperl and Apache you are using?
> 
> In my logfiles I see the timestamp and Embperl writes to the 
> logfile with
> APLOG_ERR as level.
> 
> Gerald
> 
> 



RE: Embperl and Apache LogLevel configuration

1999-10-18 Thread Gerald Richter

>
> I've my apache loglevel currently set to crit, but Embperl errors
> such as the
> one below continue to show up in my error_log.
>
> [3396892]ERR:  30: Line 1: Not found /usr/lund/wwwfiles/wnetdoc/map.c.html
>
> Only if my LogLevel is set to error or a more verbose level
> should this error
> find its way to the log file, yes? Also, where are the apache
> timestamp and
> error-type in Embperl-generated errors?
>

Which version of Embperl and Apache you are using?

In my logfiles I see the timestamp and Embperl writes to the logfile with
APLOG_ERR as level.

Gerald



Re: Apache::ASP - accessing Session data from Application

1999-10-18 Thread Joshua Chamas

Adi wrote:
> 
> Thanks for your help.  I guess I was wondering if one could get a reference
> to the $Session object directly without needing to add each value to

no, you have access to the current $Session, but not to other users'
$Sessions.

> $Application as it is stored.  So to access arbitrary Session data from
> Application I need to store it in Application at the same time it's stored
> in Session?  e.g.
> 
> $Session->{'foo'} = "data";
> $Application->{'Session'.$Session->{SessionID}} = { 'foo' => "data" };
> 

yes

> Do you think there are any advantages to adding a "Get_Session" method to
> $Application that will return a reference to the Session object with a given
> ID?  e.g.
> 

Only if you do.  Why would you want to do such a thing ?  There
may be other ways around your problem. 

> my $sessobj = $Application->Get_Session("87c6039a20a50a01000a054b547add4b");
> print $sessobj->{'foo'};
> 
> That way I wouldn't have to go through all my code adding Session data to
> Application. :)  How hard would implementing such a method be?
> 

Not terribly.

> Yes, I'm using DB_File to store data, so the size won't be a problem.  BTW,
> are there still problems using Storable with DB_File?
> 

Apache::ASP uses Data::Dumper with MLDBM to store data internally.

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NODEWORKS >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: Apache::ASP - accessing Session data from Application

1999-10-18 Thread Adi


Thanks for your help.  I guess I was wondering if one could get a reference
to the $Session object directly without needing to add each value to
$Application as it is stored.  So to access arbitrary Session data from
Application I need to store it in Application at the same time it's stored
in Session?  e.g.

$Session->{'foo'} = "data";
$Application->{'Session'.$Session->{SessionID}} = { 'foo' => "data" };


Do you think there are any advantages to adding a "Get_Session" method to
$Application that will return a reference to the Session object with a given
ID?  e.g.

my $sessobj = $Application->Get_Session("87c6039a20a50a01000a054b547add4b");
print $sessobj->{'foo'};

That way I wouldn't have to go through all my code adding Session data to
Application. :)  How hard would implementing such a method be?


Yes, I'm using DB_File to store data, so the size won't be a problem.  BTW,
are there still problems using Storable with DB_File?

Thanks again,
Adi


Joshua Chamas wrote:
> 
> You end up having to add the information that you want
> to $Application yourself, and cleaning that up in
> Session_OnEnd.



Re: Apache::ASP - accessing Session data from Application

1999-10-18 Thread Joshua Chamas

Adi wrote:
> 
> Is it possible to access data from an arbitrary $Session object from the
> $Application object.  For example, say for each Session opened, I store the
> username in $Session->{'user'}.  Can I get a list of all the users currently
> connected to the server?  What about arbitrary data currently stored in the
> Session object?
> 

Check out the online demo at:
  http://www.nodeworks.com/asp/eg/global_asa_demo.asp

or just site/eg/global_asa_demo.asp in the asp distribution
for an example of this kind of user tracking in $Application.

You end up having to add the information that you want
to $Application yourself, and cleaning that up in 
Session_OnEnd.

Remember that if you are using SDBM_File databases
for $Application & $Session, default, you only have
1024 bytes to store the key and value, so you can't
store a lot of user data like:

  $Application->{users} = \%users;

you have do do more like:

  $Application->{user1} = name;
  $Application->{user2} = name;

Or you could switch to DB_File for larger amounts
of data stored in one hash key.

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NODEWORKS >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: weird mod_perl startup problems

1999-10-18 Thread Doug MacEachern


> > > I would like to load the following modules at start up (I have them in 
>startup.perl file

> > >END failed--cleanup aborted.
> > > END {
> > > DBI->trace_msg("-> DBI::END\n", 2);  ##LINE 
>311

wait, this happens at startup?  you must have mod_perl configured as a
dso, notice in the ToDo file:
- USE_DSO=1 --> END blocks are run at startup time

END blocks are normally not supposed to run until child_exit.
could be something related to that, try linking static instead of dso,
does the problem go away?

-Doug



RE: hanging processes

1999-10-18 Thread Doug MacEachern

given the process pid, there are two ways to find out where it's hanging:

depending on os:
% truss -p $pid
 or
% strace -p)

and

% gdb /usr/local/apache/bin/httpd $pid
(gdb) where

-Doug



Embperl and Apache LogLevel configuration

1999-10-18 Thread Christian Gilmore

I've my apache loglevel currently set to crit, but Embperl errors such as the
one below continue to show up in my error_log.

[3396892]ERR:  30: Line 1: Not found /usr/lund/wwwfiles/wnetdoc/map.c.html

Only if my LogLevel is set to error or a more verbose level should this error
find its way to the log file, yes? Also, where are the apache timestamp and
error-type in Embperl-generated errors?

Regards,
Christian

-
Christian Gilmore
Senior Technical Staff Member
AT&T Labs IP Technology, Florham Park
[EMAIL PROTECTED]
http://www.research.att.com/info/cgilmore



RE: hanging processes

1999-10-18 Thread Eric Cholet

On Monday, October 18, 1999 5:42 PM, Marc D. Spencer [SMTP:[EMAIL PROTECTED]] wrote:
> Hi.
> 
>   I have an apache server (1.3.6/Solaris 5.6) running mod_perl/1.21.
> 
>   For it, I have a fairly complex handler involving several classes, some
> of which bind to libraries (one of them is ImageMagick).
> 
>   The server is configured to only allow requests for this module, and does
> not serve any static pages.
> 
>   At least once a day, I will find an http process monopolizing one of the
> 4 CPU's in our production machine (E-450); server-status claims it's in W
> mode (waiting for connection) but the log that our module generates
> indicates it hangs at an arbitrary point within it's flow.

For what it's worth, I've been experiencing the same situation. Happens less
often, but that may be just because I have less trafic. Mind that W mode is
'sending reply' which is consistent with the module being hung.
I haven't raised this issue on the list because I haven't been able to track
it down and therefore I assume it's a bug in my code. Since I do socket stuff
I could very well be blocking on a system call.


> 
>   We have poured over the code, and over the FAQ's, etc, at the mod_perl
> site, but have no ideas beyond a cron to kill these abhorrant processes
> when their cume CPU time exceeds some level (not a great measure...we had
> to set the threshold very high as to not kill happy processes).
> 
>   Can someone shed any light on what may be happening, or a better way to
> monitor and kill these children?
> 
> Thanks, in advance.
> Marc Spencer
> www.kodak.com

--
Eric



code cache

1999-10-18 Thread Neeme Vool


Hi, as I can see, my first letter didn't get any attention. I think such
"behavior" is very weird:

Lets consider two separate files, with different names:
first.html


[-$qstr="/trtickets/solvermodules/contract_ver2_refuse.html?$fdat{blaah}";-]
Blaah
[-$qstr="/trtickets/solvermodules/contract_ver2_pysi.html?$fdat{blaah}";-]
Blaah


second.html


[-$qstr="/trtickets/solvermodules/contract_ver2_refuse.html?$fdat{blaah}";-]
Blaah
[-$qstr="/trtickets/solvermodules/contract_ver2_uucp.html?$fdat{blaah}";-]
Blaah


when I load some times file first.html, I see every time source:


Blaah
Blaah


Thats ok.
and then, when i load file second.html, I excpect to see source:


Blaah
Blaah


but I get:


Blaah
Blaah


And I have tens of such effects. 

Any ideas?
Neeme Vool





hanging processes

1999-10-18 Thread Marc D. Spencer

Hi.

  I have an apache server (1.3.6/Solaris 5.6) running mod_perl/1.21.

  For it, I have a fairly complex handler involving several classes, some
of which bind to libraries (one of them is ImageMagick).

  The server is configured to only allow requests for this module, and does
not serve any static pages.

  At least once a day, I will find an http process monopolizing one of the
4 CPU's in our production machine (E-450); server-status claims it's in W
mode (waiting for connection) but the log that our module generates
indicates it hangs at an arbitrary point within it's flow.

  We have poured over the code, and over the FAQ's, etc, at the mod_perl
site, but have no ideas beyond a cron to kill these abhorrant processes
when their cume CPU time exceeds some level (not a great measure...we had
to set the threshold very high as to not kill happy processes).

  Can someone shed any light on what may be happening, or a better way to
monitor and kill these children?

Thanks, in advance.
Marc Spencer
www.kodak.com


"0201: Keyboard Error.  Press F1 to continue."
  -- IBM PC-XT Rom, 1982
\---\
 \ Marc D. Spencer   Any opinions expressed here \
  \ Applications Engineer  are my own and are not \
   \ Network Servicesnecessarily those of my   \
\ Eastman Kodak Companyemployer.\
 \---\



RFC: new section: using RPM to install mod_perl + RPM itself!

1999-10-18 Thread Stas Bekman


Hi, all

Geoffrey S Young and David Harris created both the RPM and documented the
logic and possible pitfals with installing mod_perl from RPMs. Those of
you that have asked for help regarding RPMs, would you please go thru the
document and see whether it answers your woes, and of course the RPM
itself.

This is imporant to do it now, while things are hot. Take the chance while
Geoffrey and David are ready to help and jump on it - try it send your
comments. (I don't say they wouldn't in the future, you know how it works 
:)

The moment you refine both the RPM and the document, others would have
much easier times with installing mod_perl, becoming and active user,
tester and even developer. So we are all to benefit from this movement
(Please, no flames - RPM is bad, install from scratch -- there is no
reason to scare away new potential users. Just remember that this RPM
would be installed on millions PCs of RH and other Linux users! So it
worth to take the effort and fine tune this section and the RPM.)

Thank you!

Either read the HTML version at:
http://perl.apache.org/guide/install.html#using_RPM_DEB_and_other_package

Or I'll reproduce it here in text:

A word on mod_perl RPM packages

The virtues of RPM packages is the subject of much debate among mod_perl
users. While RPMs do take the pain away from package
installation and maintenance for most applications, the nuances of
mod_perl make RPMs somewhat less than ideal for those just getting
started. The following help and advice is for those new to mod_perl,
Apache, Linux, and RPMs. If you know what you are doing, this is
probably old hat - contributing your past experiences is, as always,
welcome by the community. 

[TOC]


  Getting Started

If you are new to mod_perl and are using this Guide and the Eagle book to
help you on your way, it is probably better to grab the latest
Apache and mod_perl sources and compile the sources yourself. Not only
will you find that this is less daunting than you suspect, but it will
probably save you a few headaches down the line for several reasons. 

First, given the pace at which the open source community produces
software, RPMs, especially those found on distribution CDs, are often
several versions out of date. The most recent version will not only be
more stable, but will likely incorporate some new functionality that you
will eventually want to play with. 

It is also unlikely that the file system's layout of an RPM package will
match what you see in either the Eagle book or this Guide. If you are
new to mod_perl, Apache, or both, you will probably want to get familiar
with file system used by the examples given here before trying
something less standard. 

Finally, the RPMs found on a typical distribution CDs use mod_perl build
with Apache's Dynamic Shared Objects (DSO) support. While
mod_perl can be successfully used as a DSO module, it adds a layer of
complexity that you may want to live without for now. 

All that being said, should you still feel that rolling your own mod_perl
enabled Apache server is not likely, here are a few helpful hints... 

[TOC]


 Compiling RPM source files

It is possible to compile the source files provided my RPM packages, but
if you are using RPMs to ease mod_perl installation, that is not the
way to do it. Both Apache and mod_perl RPMs are designed to be
install-and-go. If you really want to compile mod_perl to your own
specific needs, your best bet is to get the most recent sources from CPAN. 

[TOC]


   Mix and Match RPM and source

It is probably not the best idea to use a self-compiled Apache with a
mod_perl RPM (or vice versa). Sticking with one format or the other at
first will result in fewer headaches and more hair. 

[TOC]


   Installing a single apache+mod_perl RPM

If you use an apache+mod_perl RPM, chances are rpm -i or glint (GUI for
RPM) will have you up and running immediately, no
compilation necessary. If you encounter problems, try downloading from
another mirror site or searching http://rpmfind.net/ for a different
package - there are plenty out there to choose from. 

David Harris has started the efforts to build a better RPM/SRPM mod_perl
packages. You will find them at:
http://www.davideous.com/modperlrpm/distrib/ 

Features of this RPM: 

 Installs mod_perl as an ``add in'' to the RedHat Apache package, but
does not install mod_perl as a DSO and all the problems that
 brings. 

 Includes the four header files required for building libapreq
(Apache::Request) 

 Distributes plain text forms of the pod documentation files that come
with mod_perl. 

 Checks the module magic number on the existing apache package to see
if things are compatible 

Notes on this un-conventional RPM packaging of mod_perl 

by David Harris <[EMAIL PROTECTED]> on Oct 13, 1999 

This package will install the mod_perl library files on your mach

How to disconnect persistent db connections when killing httpd

1999-10-18 Thread Oleg Bartunov

Hi,

I keep persistent db connections and would like to 
explicitly disconnect db when killing httpd.
I have custom module where I initialize db connection, prepare sth's
( will use them in Mason components ) once for per children
and several methods which have deal with my database. Here I have
DESTROY method which supposed to disconnect all connections.

sub DESTROY {
  my $self= shift;
  $self->disconnect;
  warn "Db connection finished $self ...\n";
}

$self->disconnect is a sub which finish all sth's and disconnects connection
with db. But I have nothing in error log when I kill httpd and I didn't
understand what's happens because if I comment call $self->disconnect
I see messages from DESTROY method foreach children:
Db connection finished My::DB=HASH(0x80cd240) ...

So, is't worth to try explicitly disconnect db when httpd gets killed
and how to do this using standard method like DESTROY without
catching signals and etc.

Another question:
If I keep persistent connection httpd <-> db and did some changes in 
db, say dump/reload table. How to refresh existing dbh ?


Regards,

Oleg 


I wrote script to emulate above. I expected warn message from DESTROY 
method when script finished.
1. DESTROY is just warn
  18:38[zeus]:~/app/discovery/test/bench/dbi>tt.pl
  Db connection finished My::DB=HASH(0x80cd240) ...
2. DESTROY calls $self->disconnect and then warn
  18:40[zeus]:~/app/discovery/test/bench/dbi>tt.pl 
  
  Nothing is there.




test script:

#!/usr/local/bin/perl
use strict;
use My::DBtest;

# use this connect string
$ENV{DBI_DSN} = "dbi:Pg(RaiseError=>1,AutoCommit=>0):dbname=discovery";
#DBI->trace(2);
 my ($dbh, $count );
 $dbh = My::DB->new(1);
# $dbh->disconnect;

--

Simplified version of module My/DBtest.pm

package My::DB;
$VERSION = 0.1;
use strict;
use DBI;

my %query = (
   sth0 => 'select count(*) from messages',
);
my $self = {};


sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;
  $self->{dbh} = DBI->connect() or die ("Connections fails; $!\n");
  prepare_sth($self);
  bless ( $self, $class);
  $self;
}

sub prepare_sth {
my $self = shift;
foreach my $sth (keys %query) {
   $self->{$sth} = $self->{dbh}->prepare ( $query{$sth});
}
}

sub disconnect {
 my $self = shift;
 $self->sth_finish;
 $self->{dbh}->disconnect;
 warn "disconnected ..\n";
}

sub sth_finish {
  my $self = shift;
  foreach my $sth (keys %query) {
   $self->{$sth}->finish;
  }
}


sub DESTROY {
  my $self= shift;
  $self->disconnect;
  warn "Db connection finished $self ...\n";
}

1;
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83





Re: More on web application performance with DBI

1999-10-18 Thread Tim Bunce

On Mon, Oct 18, 1999 at 07:08:09AM -0700, Michael Peppler wrote:
> Tim Bunce writes:
>  > On Fri, Oct 15, 1999 at 11:42:29AM +0100, Matt Sergeant wrote:
>  > > On Fri, 15 Oct 1999, Perrin Harkins wrote:
>  > > > On Thu, 14 Oct 1999, Jeffrey Baker wrote:
>  > > > > Zero optimization: 41.67 requests/second
>  > > > > Stage 1 (persistent connections): 140.17 requests/second
>  > > > > Stage 2 (bound parameters): 139.20 requests/second
>  > > > > Stage 3 (persistent statement handles): 251.13 requests/second
>  > > > 
>  > > > I know you said you don't like it because it has extra overhead, but would
>  > > > you mind trying stage 3 with prepare_cached rather than your custom
>  > > > solution with globals?  For some applications with lots of SQL statements,
>  > > > the prepare_cached appraoch is just much more manageable.
>  > > 
>  > > Sadly prepare_cached doesn't always work very well - at least not with
>  > > Sybase (and I assume MSSQL). Just a warning.
>  > 
>  > Could you be more specific?
> 
> I've never looked at prepare_cached() for DBD::Sybase, and Matt tried
> it out and it appeared not to work.

"appeared not to work" isn't much more specific :-)

> I would guess that this is again
> an issue of having to open multiple connections if you prepare more
> than one statement.

Here's the code:

sub prepare_cached {
my ($dbh, $statement, $attr, $allow_active) = @_;
my $cache = $dbh->FETCH('CachedKids');
$dbh->STORE('CachedKids', $cache = {}) unless $cache;
my $key = ($attr) ? join(" | ", $statement, %$attr) : $statement;
my $sth = $cache->{$key};
if ($sth) {
Carp::croak("prepare_cached($statement) statement handle $sth is still 
active")
if !$allow_active && $sth->FETCH('Active');
return $sth;
}
$sth = $dbh->prepare($statement, $attr);
$cache->{$key} = $sth if $sth;
return $sth;
}

Tim.



RE: new for embperl...

1999-10-18 Thread Jearanai Vongsaard


On Mon, 18 Oct 1999, Gerald Richter wrote:

> Your config looks ok to me, the result is strange! Did the "make test" of
> Embperl work for you without errors?
> 
> Gerald
> 

Here is my make test in embperl:

esip 27# make test
PERL_DL_NONLAZY=0 /usr/sbin/perl -Iblib/arch -Iblib/lib
-I/usr/freeware/lib/perl5/5.00502/irix-n32
-I/usr/freeware/lib/perl5/5.00502 test.pl

loading...ok

Testing offline mode...

ascii...  ok
pure.htm...   ok
plain.htm...  ok
plain.htm...  ok
plain.htm...  ok
plainblock.htm... ok
plainblock.htm... ok
error.htm...  ok
error.htm...  ok
error.htm...  ok
unclosed.htm...   ok
notfound.htm...   ok
noerr/noerrpage.htm...ok
errdoc/errdoc.htm...  ok
rawinput/rawinput.htm...  ok
var.htm...ok
varerr.htm... ok
varerr.htm... ok
escape.htm... ok
tagscan.htm...ok
tagscan.htm-d 1 ...   ok
if.htm... ok
ifperl.htm... ok
loop.htm...   ok
loopperl.htm...   ok
table.htm...  ok
table.htm-d 1 ... ok
lists.htm...  ok
mix.htm...ok
nesting.htm...ok
object.htm... ok
discard.htm...ok
input.htm...  ok
hidden.htm... ok
java.htm...   ok
inputjava.htm...  ok
include.htm...ok
includeerr1.htm...ok
includeerr2.htm...ok
callsub.htm...ok
callsub.htm...ok
importsub.htm...  ok
importsub.htm...  ok
importsub2.htm... ok
importmodule.htm...   ok
recursexec.htm... ok
nph/div.htm...ok
nph/npherr.htm... ok
nph/nphinc.htm... ok
sub.htm...ok
sub.htm...ok
chdir.htm...  ok
chdir.htm...  ok
allform/allform.htm...ok
stdout/stdout.htm...  ok
nochdir/nochdir.htm...ok
div.htm...ok
ofunc/div.htm...  ok
safe/safe.htm...  ok
safe/safe.htm...  ok
safe/safe.htm...  ok
opmask/opmask.htm...  ok
opmask/opmasktrap.htm...  ok

Testing Execute function...

div.htm from file...  ok
div.htm from memory...ok
div.htm to memory...  ok
div.htm from/to memory... ok
error.htm to memory...ok
Use of uninitialized value at (eval 1218) line 1.


Starting httpd...   pid = 8057  ok

Testing mod_perl mode...

ascii...   8057:/usr/local/apache/bin/httpd: rld:
Fatal Error: attempted access to unresolvable symbol in
blib/arch/auto/HTML/Embperl/Embperl.so: mod_perl_sent_header
ERR:unexpected EOF before status line seen
Input:  test/html/ascii
Output: test/tmp/out.htm
Compared to:test/cmp/error.htm
Log:test/tmp/test.log

 ERRORS detected! NOT all test have been passed successfully

Callback called exit.
END failed--cleanup aborted.
*** Error code 9 (bu21)
esip 28# 

--apple

> 
> 
> ---
> Gerald Richter  ecos electronic communication services gmbh
> Internet - Infodatenbanken - Apache - Perl - mod_perl - Embperl
> 
> E-Mail: [EMAIL PROTECTED] Tel:+49-6133/925151
> WWW:http://www.ecos.de  Fax:+49-6133/925152
> ---
> 
> 
> > -Original Message-
> > From: Jearanai Vongsaard [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, October 18, 1999 2:14 AM
> > To: Gerald Richter
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: new for embperl...
> >
> >
> > I did try http://esip.gmu.edu:8529/embperl/x/loop.htm and it still didn't
> > work. The netscape pop up a window that say "document contain no data".
> > The error_log file does not show any error until I typed
> > http://esip.gmu.edu:8529/emperl/x/loop.htm. ( I try to mispell the embperl
> > for checking error). The error_log will show -->
> >
> > [Sun Oct 17 20:04:01 1999] [error] [client 129.174.124.125] File does not
> > exist: /usr/local/apache/htdocs/emperl/x/loop.htm
> >
> > If you want to try, please go to look at the following url.
> >
> > http://esip.gmu.edu:8529/ --> it's work
> > http://esip.gmu.edu:8529/hello/siesip --> it's work
> > http://esip.gmu.edu:8529/embperl/x/loop.htm --> it doesn't work
> >
> > The file loop.htm is located in
> >
> > /usr/local/apache/HTML-Embperl-1.2b9/eg/x/loop.htm
> >
> > So, I did attach my startup.pl and httpd.conf within this mail.
> >
> > Sorry, for my dump question. I have no idea what did I do wrong? Please
> > give me some help...
> >
> > --a

Re: More on web application performance with DBI

1999-10-18 Thread Michael Peppler

Tim Bunce writes:
 > On Fri, Oct 15, 1999 at 11:42:29AM +0100, Matt Sergeant wrote:
 > > On Fri, 15 Oct 1999, Perrin Harkins wrote:
 > > > On Thu, 14 Oct 1999, Jeffrey Baker wrote:
 > > > > Zero optimization: 41.67 requests/second
 > > > > Stage 1 (persistent connections): 140.17 requests/second
 > > > > Stage 2 (bound parameters): 139.20 requests/second
 > > > > Stage 3 (persistent statement handles): 251.13 requests/second
 > > > 
 > > > I know you said you don't like it because it has extra overhead, but would
 > > > you mind trying stage 3 with prepare_cached rather than your custom
 > > > solution with globals?  For some applications with lots of SQL statements,
 > > > the prepare_cached appraoch is just much more manageable.
 > > 
 > > Sadly prepare_cached doesn't always work very well - at least not with
 > > Sybase (and I assume MSSQL). Just a warning.
 > 
 > Could you be more specific?

I've never looked at prepare_cached() for DBD::Sybase, and Matt tried
it out and it appeared not to work. I would guess that this is again
an issue of having to open multiple connections if you prepare more
than one statement.

Michael
-- 
Michael Peppler -||-  Data Migrations Inc.
[EMAIL PROTECTED]-||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]



Re: weird mod_perl startup problems

1999-10-18 Thread Eugene Miretskiy

Doug MacEachern wrote:
> 
> very wierd.  do you have PerlFreshRestart On?  try turning it Off.  there
> was a report a while ago about one of the MIME:: modules pulling a stunt
> at the file-scope level, that is only exposed if the module is reloaded
> (which FreshRestart does)
> 
> -Doug

I do not have FreshRestart on...

> 
> On Thu, 7 Oct 1999, Eugene Miretskiy wrote:
> 
> > Hello,
> >
> > After upgrading my machine to FreeBSD3.3, I ran into the problems loading modules
> > at startup time...
> >
> > I would like to load the following modules at start up (I have them in 
>startup.perl file
> > loaded from httpd.conf):
> >
> >   use Apache::Registry;
> >   use Apache::Request;
> >   use Apache::DBI ();
> >   use MIME::Body;
> >
> > The server does not start -- instead I get this in my error_log:
> >Can't locate object method "trace_msg" via package "DBI" at
> > /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBI.pm  line 311.
> >END failed--cleanup aborted.
> >run: Operation not supported by device
> >
> > An interesting thing is that if I comment out MIME::Body (leave Apache::DBI) the 
>server starts ok.
> > If I comment out Apache::DBI (leave MIME::Body) the server also starts ok.
> > Only when both of these modules are loaded I gen into a problem.
> >
> > Here is a snipplet of code from DBI that causes the problem:
> > END {
> > DBI->trace_msg("-> DBI::END\n", 2);  ##LINE 311
> > # Let drivers know why we are calling disconnect_all:
> > $DBI::PERL_ENDING = $DBI::PERL_ENDING = 1;  # avoid typo warning
> > DBI->disconnect_all() if %DBI::installed_drh;
> > DBI->trace_msg("<- DBI::END complete\n", 2);
> > }
> >
> > Finally, If I comment out DBI->trace_msg, the server starts fine with both 
>Apache::DBI and
> > MIME::Body loaded.
> >
> > Any ideas to this weirdness?
> >
> > All modules are latest version.
> >
> > Thank you very much.
> >
> > P.S.: please reply to my email address as well ([EMAIL PROTECTED])
> >
> > --
> >   Eugene Miretskiy <[EMAIL PROTECTED]>
> >   InVision, INC.  (516) 543-1000x219
> >   http://www.invision.net
> >

-- 
  Eugene Miretskiy <[EMAIL PROTECTED]>
  InVision, INC.  (516) 543-1000x219  
  http://www.invision.net



KeepAlive in mod_perl/proxy setup is evil...

1999-10-18 Thread Stas Bekman


[CC'ing this to modperl list, this is something of general interest and
a good topic for an interesting thread]

> Just reading through your excellent mod_perl guide and the section regarding
> using accelerator/cache proxies made me think of the following question:
> 
> What about HTTP/1.1 and keepalive connections? In this case, I'd guess
> that the client will only close the connection after it has downloaded
> all the HTML it is interested in and thus the server and proxy
> connection might remain open for the duration of the session to the
> client? This would mean that the proxy does not provide an advantage at
> all. Correct?

Idealy, one of the big advantages proxy provides for mod_perl is downsteam
buffering. What happens is that mod_perl immediately generates the output,
hadles it to proxy to return to a slow user, which immediately allows to
close a connection. So the first question is how big your proxy buffer,
since if mod_perl cannot send it all to proxy it doesn't really helps.

You are talking about KeepAlive... Hmm, I think you are right, I should
have mentioned this point. Do you think the KeepAlive should be turned
off? Since there is no actually need for this option (all the static
objects are being served by a lighter process). But if the KeepAlive is
on, mod_perl will keep the connection open, till it timeouts or
terminated. So it breaks all the "improvements" down :(

If I'm not missing something, you've got a real case here. 

What do you think folks?

This issue should be really benchmarked... since there is lots of theories
but no numbers... 

Anyone has checked his ProxyBuffer size? How big can it be in squid and
mod_proxy? I saw a few folks reporting about limitation of the buffer
size. I really would like to have a better picture of this vague topic.
Anyone can share his experince, and shed some details on this topic?

Thanks!

> PS. I must admit not to have studied this in detail to see what would
> happen. I've only used proxies in the traditional mode and not as httpd
> accelerators.

___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: More on web application performance with DBI

1999-10-18 Thread Tim Bunce

On Fri, Oct 15, 1999 at 11:42:29AM +0100, Matt Sergeant wrote:
> On Fri, 15 Oct 1999, Perrin Harkins wrote:
> > On Thu, 14 Oct 1999, Jeffrey Baker wrote:
> > > Zero optimization: 41.67 requests/second
> > > Stage 1 (persistent connections): 140.17 requests/second
> > > Stage 2 (bound parameters): 139.20 requests/second
> > > Stage 3 (persistent statement handles): 251.13 requests/second
> > 
> > I know you said you don't like it because it has extra overhead, but would
> > you mind trying stage 3 with prepare_cached rather than your custom
> > solution with globals?  For some applications with lots of SQL statements,
> > the prepare_cached appraoch is just much more manageable.
> 
> Sadly prepare_cached doesn't always work very well - at least not with
> Sybase (and I assume MSSQL). Just a warning.

Could you be more specific?

Tim.



Apache::ASP - accessing Session data from Application

1999-10-18 Thread Adi

Is it possible to access data from an arbitrary $Session object from the
$Application object.  For example, say for each Session opened, I store the
username in $Session->{'user'}.  Can I get a list of all the users currently
connected to the server?  What about arbitrary data currently stored in the
Session object?

In global.asa I have

sub Session_OnStart {
  $Session->{'user'} = Apache->request->connection->user;
  my %session;
  if (ref $Application->{'Session'} eq "HASH") {
 %session = %{$Application->{'Session'}};
  }
  $session{$Session->{'SessionID'}} = $Session;
  $Application->{'Session'} = { %session };
}

sub Session_OnEnd {
  delete $Application->{'Session'}->{'SessionID'};
}


But this only stores the Session hash as it is when the session starts.  So
I only get the user data value.  Any data that gets added to Session after
it starts doesn't show up in $Application->{'Session'}->{'SessionID'}

Is there a way to get a reference to a session object given the SessionID? 
If not, is there any plans on adding that feature?  If not, I'd be happy to
code in that functionality if no one's working on it.

Adi



RE: Your thoughts about authentication

1999-10-18 Thread Eric Cholet

On Sunday, October 17, 1999 5:24 AM, Miguel A.L. Paraz [SMTP:[EMAIL PROTECTED]] wrote:
> Hi all,
> 
> I would like to know if this is at all possible with the "stock" modules,
> or if I have to rolly my own.
> 
> I want to make a "membership" site where users can access their private
> pages ats http://site/private/username/.  /private will map to a script
> (or if the case may be, a module) that just looks at /username/... and
> does something accordingly.  I would like the access to be authenticated -
> whether through HTTP authentication, or a username/password dialog 
> (any opinions on which to use?)
> 
> Then, for accesses to http://site/public/username/, depending on the 
> user's preference, they can grant access to the public without authentication,
> or they may restrict it to another set of users.

You can use .htaccess files to let your users specify authentication.
 
> Since /public and /private are not real directories, AuthenDBI cannot protect
> them, can it?

Sure it can. Authentication can be applied to arbitrary URL's using .
It doesn't matter what the URL translates to.

> 
> Thanks!
> ---m
> 

--
Eric