Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Avoiding multiple cgi instances (http://www.velocityreviews.com/forums/t883325-avoiding-multiple-cgi-instances.html)

brendan 10-29-2003 04:13 AM

Avoiding multiple cgi instances
 
hi all,

I'm writing a little script that just takes a http post and adds the
post to a messageboard page.

However, I'm concerned that Apache might activate my script while a
previous invocation is still active, causing all sorts of problems
because I haven't locked them as separate transactions.

Is there a way in Perl (or Apache) to make sure that a new invocation
won't be made until the first invocation is finished?

thanks!

Sam Holden 10-29-2003 04:42 AM

Re: Avoiding multiple cgi instances
 
On 28 Oct 2003 20:13:58 -0800, brendan <brendan@symonty.org> wrote:
> hi all,
>
> I'm writing a little script that just takes a http post and adds the
> post to a messageboard page.
>
> However, I'm concerned that Apache might activate my script while a
> previous invocation is still active, causing all sorts of problems
> because I haven't locked them as separate transactions.
>
> Is there a way in Perl (or Apache) to make sure that a new invocation
> won't be made until the first invocation is finished?


No.

You can simply obtain a lock of some sort in the script before actually
doing anything. Exclusively locking a certain file, for example.

Or use a backend that does it all for you (a database that supports
transactions, for example).

--
Sam Holden

Eric J. Roode 10-29-2003 04:53 AM

Re: Avoiding multiple cgi instances
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

brendan@symonty.org (brendan) wrote in
news:282ee219.0310282013.306dc59c@posting.google.c om:

> I'm writing a little script that just takes a http post and adds the
> post to a messageboard page.
>
> However, I'm concerned that Apache might activate my script while a
> previous invocation is still active, causing all sorts of problems
> because I haven't locked them as separate transactions.
>
> Is there a way in Perl (or Apache) to make sure that a new invocation
> won't be made until the first invocation is finished?


In general, this is a bad idea. You should instead do the locking. Maybe
it's extra work, but it's scalable and is generally the Right Thing to do.

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP59HyWPeouIeTNHoEQLomQCgv0ZpJRztgvMwvX1Bu+Qb75 M7tq4AoLev
7AagzdRRWY9/tNGsFeKuQlJN
=OtZN
-----END PGP SIGNATURE-----


All times are GMT. The time now is 02:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.