Caught a SIGPIPE in perl handler

2005-11-21 Thread Pete Smith
Hi,

I am using HTML::Mason and use the perl handler method of configuring it. I
occasionally get this error in error log (it causes a 500):

[Fri Nov 18 20:29:12 2005] [error] Caught a SIGPIPE at /etc/mason.pl line 52

Line 52 is where I get the Apache::Request object. Here is my handler:

...

sub handler {
  # Get the Apache request object
  my $r = Apache::Request->new(shift,
   POST_MAX=> 1 * 1024 * 1024, # 1MB
   DISABLE_UPLOADS => 0,
   TEMP_DIR=> '/tmp/.uploadmason/',
  );

  my $ah = new HTML::Mason::ApacheHandler(comp_root=>
$r->document_root(),
  data_dir =>
$r->document_root() . '/.mason',
  args_method  => 'mod_perl',
  dhandler_name=> 'dhandler.mh',
  autohandler_name =>
'autohandler.mh',
  error_mode   => 'fatal',
 );

  # only handle text
  return DECLINED
if (defined($r->content_type) and $r->content_type !~ m|^text/|io);

  # get db connection
  $HTML::Mason::Commands::dbh = DBI->connect('DBI:mysql:database=###',
 '###',
 '###',
 {RaiseError => 1, AutoCommit =>
1},
);

  # blank vars
  %HTML::Mason::Commands::vars = ();

  # set 'args_method' in %vars
  $HTML::Mason::Commands::vars{MASON}->{args_method} = $ah->args_method();

  # send mason powered header
  $r->headers_out->set('X-Powered-By' => 'HTML::Mason');

  my $status = $ah->handle_request($r);

  $HTML::Mason::Commands::dbh->disconnect();

  return $status;
}

I cannot find any refernces to this type of error. It is not the 'Caught
SIGPIPE' line you can find in the log if you use Apache::SIG to catch
stopped requests. However, I am not sure what it means!

Any help or pointers on debugging would be gratefully received!

Cheers,
Pete



Popcorn Web Design ltd
15A, Cambridge Road, Stansted, Essex CM24 8BX
t (direct): 0207 193 7022
t (office): 01279 812229
f: 0870 831 6999
www.popcornwebdesign.co.uk

This email is confidential. It may also be privileged or otherwise protected
by other legal rules. If you are not the intended recipient please notify
the sender immediately, and delete the message from all locations in your
computer. You should not copy the email or use it for any purpose, or
disclose its contents to any other person: To do so may be unlawful. Email
is subject to possible data corruption you should not rely on advice
contained in an email without obtaining written confirmation of it.



Re: Apache2::ServerRec->add_config and directives

2005-11-21 Thread Philippe M. Chiasson
Arne Skjaerholt wrote:
> Hi all,
> I'm trying to write a system that writes its own config data to
> httpd.conf using Apache2::ServerRec->add_config from
> Apache2::ServerUtil, but I'm running into some troubles with
>  directives.

Posting a short code sample might be usefull to better explain
what you are doing.

> The handler is running as a PostConfigHandler (I've also tried
> OpenLogsHandler), and it works fine until I try setting a 
> directive, in which case the main server process segfaults (on OS X it
> says "Bus Error", but I'm assuming it's more or less the same thing).

Even better, try and make a self-contained example of this with geoff's
apache-test skeleton traball:

 http://people.apache.org/~geoff/bug-reporting-skeleton-mp2.tar.gz

> I've tried putting the PerlPostConfigHandler directive inside a
>  directive, but in that case my handler doesn't get run.
> 
> Does anyone see what I could be doing wrong with this?

Report a more detailled bug
  http://perl.apache.org/docs/2.0/user/help/help.html#Important_Information


Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: connection to PostgreSQL DataBase with Apache::DBI

2005-11-21 Thread Plymouth Rock
> > I tried to set PerlSetEnv/PerlPassEnv variables as described in the
guide.
> > It was difficult for me to do it properly as I did it for the first
time. I
> > even could set them incorrectly. Besides that, my mod_perl2 was
installed
> > and set up properly (it works excellently); but saying about Apache::DBI
> > module I should note that there isn't any mention about those variables
in
> > the corresponding man. Hence, it's most probably, those variables can
not be
> > a cause of my problem.
>
> The docs for Apache::DBI don't mention explicitly which
> environment variables to set, as this varies from database
> to database. Some databases may require certain environment
> variables to work; these may be visible in a cgi
> environment, but need the PerlSetEnv/PerlPassEnv directives
> in a mod_perl environment.
>
> To see if you do need such environment variables,
> try (without Apache::DBI) a mod_perl script or handler
> that connects to your database and does some simple
> operation. Does that work?
>
 Yes, it does. Yesterday I've described it in details in another
message with the
Subject:
"Re: Connection to PostgreSQL DataBase with Apache::DBI"
that addressed
To: Frank Wiles <[EMAIL PROTECTED]>
and
Copy: modperl@perl.apache.org 

Of course, I'd trying it without Apache:DBI installed as well as
without PerlSetEnv/PerlPassEnv set. It's probably, I'll be forced
to spend a few time to compose my bug report as described in
the mod_perl guide, but I'm not sure that it should be for this
Mailing List.



[ModPerl 2.0] Need help to start my project...

2005-11-21 Thread Rony Liemmukda

Hello,

We have to do a project at college and  I've chosen to write an apache 
module which should handle xslt-transformation (server-side).
Now tutorials about apache modules are a very rare as far as I see and 
although the documentation at perl.apache.org is well written I want to know
if my approach to solve my project with the help of Input/Output filters 
is correct or is there another (better) way ?
It also would be nice if someone could tell me where to find a good 
tutorial about mod_perl 2.0 online ( can't find anything usable with 
google ).
I really don't want to start this project twice because of an wrong 
beginning... ;)


Thanks