Avoiding multiple cgi instances

B

brendan

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!
 
S

Sam Holden

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).
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(e-mail address removed) (brendan) wrote in
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+Qb75M7tq4AoLev
7AagzdRRWY9/tNGsFeKuQlJN
=OtZN
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top