Modperl + DBI + Postgresql = Crash (file table full)

2000-12-31 Thread Frank Sonnemans

I am currently building an intranet site which uses a Postgresql database 
backend. Unfortunately the database server is opening more files for every 
SQL request from the web site. This quickly leads to a crash after the 
kernels file table has filled up.

As of today I have no idea about the cause of the problem. Initially I 
blamed Apache::DBI and therefore I disabled it, adding $dbh-disconnect 
statements to my code. However this has not solved the problem.

My server runs the following software:

FreeBSD 4.0 or FreeBSD 4.2 stable
Apache 1.3
ModPerl
Apache::DBI (disabling this doesn't change anything)
HTML::Mason

Any ideas on the cause of the problems. Any similar experiences?

Thanks in advance for your reply.


Frank Sonnemans





Re: Modperl + DBI + Postgresql = Crash (file table full)

2000-12-31 Thread James

usually a default OS install does not have enough
available file handles for use as a webserver.

Consider using ulimit -n, and ndd or sysctl settings
for file descriptors.

On a busy site you may need to increase the hard limit
by also modifying the kernel FDMAX #define and rebuilding.

Or you might just be having leaky code ...

Frank Sonnemans wrote:
 
 I am currently building an intranet site which uses a Postgresql database
 backend. Unfortunately the database server is opening more files for every
 SQL request from the web site. This quickly leads to a crash after the
 kernels file table has filled up.
 
 As of today I have no idea about the cause of the problem. Initially I
 blamed Apache::DBI and therefore I disabled it, adding $dbh-disconnect
 statements to my code. However this has not solved the problem.
 
 My server runs the following software:
 
 FreeBSD 4.0 or FreeBSD 4.2 stable
 Apache 1.3
 ModPerl
 Apache::DBI (disabling this doesn't change anything)
 HTML::Mason
 
 Any ideas on the cause of the problems. Any similar experiences?
 
 Thanks in advance for your reply.
 
 Frank Sonnemans

--
ActiveMessage - Targeted Email Marketing
Ask me for a free outbound email trial account!
http://ActiveMessage.com



Re: Modperl + DBI + Postgresql = Crash (file table full)

2000-12-31 Thread Andrew Ho

Hello,


FSI am currently building an intranet site which uses a Postgresql database 
FSbackend. Unfortunately the database server is opening more files for every 
FSSQL request from the web site. This quickly leads to a crash after the 
FSkernels file table has filled up.

I've run mod_perl with a PostgreSQL database before under moderate traffic
and did not encounter the problem you describe. The file descriptor limit
mentioned earlier is a general issue with running Apache, and should not
be related to mod_perl or PostgreSQL per se. Adding "ulimit -n x" to the
apachectl script (where x is some large number, I use 4096) makes this
easy and unforgettable.

Does the file descriptor problem occur when you run as a regular CGI?


FSAs of today I have no idea about the cause of the problem. Initially I 
FSblamed Apache::DBI and therefore I disabled it, adding $dbh-disconnect 
FSstatements to my code. However this has not solved the problem.

You should add $dbh-disconnect statements regardless; Apache::DBI will
render those statements harmless, and leaving them in is good practice,
and leaves your script usable out of an Apache::DBI environment.


FSApache 1.3
FSModPerl
FSApache::DBI (disabling this doesn't change anything)

What versions of this stuff, and of PostgreSQL are you using? I assume by
"Apache 1.3" you really mean 1.3.x, where x is something recent...


Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--




Help with Perl in httpd.conf

2000-12-31 Thread Scott Alexander

Hi,

I have the following in my httpd.conf file but the Limit is having no 
effect. Running perl -cx httpd.conf tells me I've got a syntax error on 
the limit line.

Any help ? 

I haven't included all the lines in the Perl section. 

It would be great if I got this to work before next year ;)

regards

Scott

Perl
#!perl

$Location {"/users/supervisor"} = {
  Limit = {"GET POST PUT DELETE "} = {
Require = 'supervisor',
  },
} ;
__END__
/Perl
_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



comparison of html/perl methodologies

2000-12-31 Thread Paul Phillips

Hello,

I have written a fairly good sized CGI using CGI.pm that I ran first as a 
standalone, then under modperl.

Now, I'm interested in looking at web authoring from the reverse 
perspective - embedding Perl in html.

A quick look tells me that there are a number of possibilities out there --
Apache ASP
Mason
Embperl
HTML::Template

There are probably some others as well...

After having looked at their respective web sites, I seem to be having 
trouble understanding how these are different from one another and their 
relative strengths and weaknesses.

Would anyone care to take a stab at making some kind of summary of 
distinctive qualities, goals, etc.

Thanks,
Paul Phillips

___
Paul Phillips
Director of Orchestral Activities, Meadows School of the Arts
Southern Methodist University

"You must sing every note you play, sing even through the rests!"
Arturo Toscanini



Help with Perl in httpd.conf

2000-12-31 Thread Scott Alexander

After searching the archives (I searched on Limit not on Perl 
like the  first time) I've changed my code to

But the limit does not work properly. I get a Directory index 
forbidden by rule: /usr/local/apache/htdocs/users/supervisor/
in the error log. 

Is the syntax still wrong or does anyone have any ideas about this?

Scott

Perl
#!perl

$Location {"/users/supervisor"} = {
  DAV = 'On',
  AllowOverride = 'None',
  Options = 'None',
  AuthName = '"Test"',
  AuthType = 'Basic',
  Auth_MySQL_Password_Table = 'users',
  Auth_MySQL_Username_Field = 'user',
  Auth_MySQL_Password_Field = 'passwd',
  Auth_MySQL_Encryption_Types = 'Plaintext',
  Auth_MYSQL = 'on',
  Limit = {
METHODS = `GET POST`,
require = `user supervisor`,
  },
} ;
__END__
/Perl
_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: comparison of html/perl methodologies

2000-12-31 Thread Perrin Harkins

On Sun, 31 Dec 2000, Paul Phillips wrote:
 Now, I'm interested in looking at web authoring from the reverse 
 perspective - embedding Perl in html.
 
 A quick look tells me that there are a number of possibilities out there --
 Apache ASP
 Mason
 Embperl
 HTML::Template
 
 There are probably some others as well...

Our numbers are legion.

 After having looked at their respective web sites, I seem to be having 
 trouble understanding how these are different from one another and their 
 relative strengths and weaknesses.
 
 Would anyone care to take a stab at making some kind of summary of 
 distinctive qualities, goals, etc.

I'm writing just such a document, but it's not finished.  For now, look
in the mailing list archives for previous discussions on this topic.

A couple of words of advice:

If this is a very simple site that will be worked on by one person and
will not change it's look very much, it doesn't matter which one you
choose.  Just grab whichever one looks like the most fun or the easiest to
get started with. 

If this is a bigger project that involves multiple coders, HTML-only
people, or will change it's look often, your work will be easier to
maintain if you keep a good separation between the "application"  code and
the "presentation" code.  This is in contrast to the PHP style of putting
all your code in-line in the HTML. 

You can do this kind of separation with just about any tool.  Mason,
Embperl, and Apache::ASP can do this by putting your code in modules which
you call at the beginning of the template and then use the results of.
(Well, they each have their own special ways of supporting this as well,
but it amounts about the same thing.)  Your templating constructs (loops,
conditionals) will be written in Perl in-lined in HTML.  HTML::Template
and Template Toolkit generally expect you to write a CGI or modperl
handler that will do some work and then run the result through a template.
The templating constructs are done with a mini templating language when
using these modules.  The basic question you have to answer is whether or
not the people who have to edit the "look and feel" part of your templates
will be happier and more productive using in-line Perl or one of these
templating languages.

If you're building a larger project and want some help figuring out how to
organize it, take a look at Apache::PageKit, which provides a skeleton for
developing applications using HTML::Template.  I use a homegrown system
which is very similar in spirit but works with Template Toolkit, which I
prefer. 

Hope that gets you started.  There's tons more in the archives.

- Perrin




Re: Help with Perl in httpd.conf

2000-12-31 Thread James G Smith

"Scott Alexander" [EMAIL PROTECTED] wrote:
Is the syntax still wrong or does anyone have any ideas about this?

I am thinking it is.  Try the following correction.

Perl
#!perl

$Location {"/users/supervisor"} = {
  DAV = 'On',
  AllowOverride = 'None',
  Options = 'None',
  AuthName = '"Test"',
  AuthType = 'Basic',
  Auth_MySQL_Password_Table = 'users',
  Auth_MySQL_Username_Field = 'user',
  Auth_MySQL_Password_Field = 'passwd',
  Auth_MySQL_Encryption_Types = 'Plaintext',
  Auth_MYSQL = 'on',
   Limit = {
 'GET POST' = {
   require = 'user supervisor',
 },
   },
} ;
__END__
/Perl

  Limit = {
METHODS = `GET POST`,
require = `user supervisor`,
  },

Also, you have backticks (`) in the above instead of single-
quotes (').  This will result in Perl trying to execute what is 
enclosed.  Probably not what you wanted.
+-
James Smith - [EMAIL PROTECTED] | http://www.jamesmith.com/
[EMAIL PROTECTED] | http://sourcegarden.org/
  [EMAIL PROTECTED]  | http://cis.tamu.edu/systems/opensystems/
+--



Re: comparison of html/perl methodologies

2000-12-31 Thread Andrew Ho

Hello,

PPNow, I'm interested in looking at web authoring from the reverse
PPperspective - embedding Perl in html.
PP
PPA quick look tells me that there are a number of possibilities out there --
PPApache ASP
PPMason
PPEmbperl
PPHTML::Template

HTML::Template is not an embedded Perl solution per se, but rather a
templating system. It's a rather fine line but the crux of it is that
rather than embedding Perl code in non-Perl text per se, it's Perl that
interprets non-Perl text in a special way.

In contrast Apache::ASP, Mason, and Embperl are all full-fledged embedded
Perl implementations. I would say that the embedded Perl implementations
are better for data-driven pages (e.g. there is more non-Perl text (HTML
or XML or whatever) than Perl code), whereas the template systems (other
ones include homegrown variable substitution and Text::Template) are
better for pages where there is more Perl code than output.

An example of the former (data-driven) might be a website that displays
and lets you manage a stock portfolio--most of it stays the same except
for some dynamic data parts. An example of the latter could be an HTTP
data server that returns XML.

Generally, it's easier to transition from a pure CGI based system to a
templatized system rather than an embedded Perl system, because a template
system basically centralizes all your print() statements into a template
fill-in call. However, I think the embedded Perl syntax gives a more
powerful separation of code and presentation.

One advantage of Apache::ASP is that its syntax (% code %, %= expr %,
etc.) and semantics are very well known, so this is great for working with
coders who may have had some exposure to ASP in the past.

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--




Re: Document Contains no data

2000-12-31 Thread Stephen A. Cochran

--- Stas Bekman wrote:
On 17 Nov 2000, Stephen A. Cochran wrote:
 
 I have a program which runs fine 90% of the time under mod_perl. About 10% of
 the time Netscape reports "Document contains no data". Looking at the socket
 traffic, the client receives an orderly release indication (T_ORDEL_IND = 132)
 on the socket and reponds with a orderly release request, which closes the
 socket. 


run it in single mode and attach to the process with strace(1) or truss(1)
(depending on what you have). See the debug chapter in the mod_perl guide.
--- end of quote ---

Thanks for the suggestions from the list for this problem. The strace/truss
probably would have helped solve the problem, too bad Digital Unix doesn't have
either : (

After two months I finally tracked it down. Turns out that in an infrequently
called sub to handle minor error conditions, there was a line "close STDERR".
The comment from the author said it was to "kill any ugly errors that havne't
made it out yet ...". Not really sure what he really wanted to do originally,
but that was the problem.

Anytime a process which had executed this code under mod_perl received another
mod_perl request, the browser displayed the "Document contains no data" error
due to the sequence of requests as described above in my original post. I just
confirmed this with a short script which only does "close STDERR".

Thought I'd post this in case someone else ever runs into this, or it's a bug.
Not sure of closing STDERR is a common practice in CGIs, but maybe a gotcha for
the porting guide. 

Steve Cochran



Help with Limit in Perl

2000-12-31 Thread Scott Alexander

Hi,

I've looked thru the archives and suggestions posted earlier do not 
help.

My code is at the moment like this:
Perl
#!perl
$Location {"/users/supervisor"} = {
  DAV = "On",
  AllowOverride = "None",
  Options = "None",
  AuthName = "Test",
  AuthType = "Basic",
  Auth_MySQL_Password_Table = "users",
  Auth_MySQL_Username_Field = "user",
  Auth_MySQL_Password_Field = "passwd",
  Auth_MySQL_Encryption_Types = "Plaintext",
  Auth_MYSQL = "on",
  Limit = {
'METHODS' = "GET", 'Require' = "valid-user",
#'METHODS' = "POST", 'Require' = "valid-user",
},
} ;
__END__
/Perl

If I uncomment the last methods line then it doesn't work at all. But 
with only one methods line like it is now it works. 

How do I use 

Apache-httpd_conf ?

regards

Scott
_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



DynDNS.org

2000-12-31 Thread Chris Reinhardt

Hi, we've been running for the last year off of mod_perl.  We currently
supply dynamic DNS aliasing for over 58,000 users, and almost 100,000
hosts. This is all run on one pIII-450 without breaking a sweat.  On an
average day we perform over 5 updates a second.


--
Chris Reinhardt
[EMAIL PROTECTED]
Webmaster
Dynamic DNS Network Services
http://www.dyndns.org/