modperl-persistant_handles_cause_gotcha

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



To: "mod_perl Mailing List" <modperl@apache.org>
From: "Jonathan M. Hollin" <netmaster@digital-word.com>
Subject: Defeating mod_perl Persistence
Date: Tue, 11 Dec 2001 12:25:23 -0000

Hey Gang,

When using Mail::Sender only the first email is sent on my mod_perl server.
When I investigated, I realised that the socket to the SMTP server was
staying open after the completion of that first email (presumably mod_perl
is responsible for this persistence).

Is there any way to defeat the persistence on the socket while running my
script under mod_perl, or do such scripts always need to be mod_cgi?

FYI, the script works fine under mod_cgi.

===

To: "Jonathan M. Hollin" <netmaster@digital-word.com>
From: Ged Haywood <ged@www2.jubileegroup.co.uk>
Subject: Re: Defeating mod_perl Persistence
Date: Tue, 11 Dec 2001 12:37:24 +0000 (GMT)

On Tue, 11 Dec 2001, Jonathan M. Hollin wrote:

> When using Mail::Sender only the first email is sent on my mod_perl server.
> When I investigated, I realised that the socket to the SMTP server was
> staying open after the completion of that first email (presumably mod_perl
> is responsible for this persistence).
> 
> Is there any way to defeat the persistence on the socket while running my
> script under mod_perl, or do such scripts always need to be mod_cgi?

The idea is for the mod_perl process to complete its job and get on
with another as quickly as possible.  Waiting around for nameserver
timeouts and such doesn't help things.

You might be better off re-thinking the design for use under mod_perl.
This is a well-trodden path, have a browse through the archives.

===

To: netmaster@digital-word.com, mod_perl Mailing List
<modperl@apache.org>
From: Eric Cholet <cholet@logilune.com>
Subject: Re: Defeating mod_perl Persistence
Date: Tue, 11 Dec 2001 16:01:05 +0100

"Jonathan M. Hollin" <netmaster@digital-word.com> wrote:

> When using Mail::Sender only the first email is sent on my mod_perl
> server. When I investigated, I realised that the socket to the SMTP
> server was staying open after the completion of that first email
> (presumably mod_perl is responsible for this persistence).
>
> Is there any way to defeat the persistence on the socket while running my
> script under mod_perl, or do such scripts always need to be mod_cgi?
>
> FYI, the script works fine under mod_cgi.

maybe you should just call Close() on the Mail::Sender object,
from the docs:

     Close
          $sender->Close;

         Close and send the mail. This method should be called
         automatically when destructing the object, but you
         should call it yourself just to be sure it gets called.
         And you should do it as soon as possible to close the
         connection and free the socket.

         The mail is being sent to server, but is not processed
         by the server till the sender object is closed!

===

To: <netmaster@digital-word.com>, "mod_perl Mailing List" <modperl@apache.org>
From: "Perrin Harkins" <perrin@elem.com>
Subject: Re: Defeating mod_perl Persistence
Date: Tue, 11 Dec 2001 11:18:16 -0500

> When using Mail::Sender only the first email is sent on my
> mod_perl server.  When I investigated, I realised that the
> socket to the SMTP server was staying open after the
> completion of that first email (presumably mod_perl is
> responsible for this persistence).

> Is there any way to defeat the persistence on the socket while running my
> script under mod_perl, or do such scripts always need to be mod_cgi?

You're probably storing it in a global so it never gets
cleaned up.  Don't do that.

===

To: "Perrin Harkins" <perrin@elem.com>,
From: "Jonathan M. Hollin" <netmaster@digital-word.com>
Subject: RE: Defeating mod_perl Persistence
Date: Wed, 12 Dec 2001 08:57:47 -0000

:: You're probably storing it in a global so it never gets cleaned 
:: up.  Don't
:: do that.

No, it's not a global Perrin - I've learnt that lesson!  :-)

===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu