Apache::Session can do the kind of exclusive locking you are after. If you're not using the MySQL locking, make sure you're passing "Transaction => 1". However, it would be better to move this kind of work to direct database actions so that you can get better control over the concurrency and locking behavior.
Sessions are good for things that are mostly read-only and don't change often (e.g. user's name). They're not so great for things that need carefully controlled locking behavior. Part of the issue is that when you use exclusive locking, a person opening a second window on your site will not get any content until the first window completes sending to the browser. That's the nature of exclusive locks. | [reply] |
Thank you for this; we will now go away and try to replicate the process with Transaction=>1 for file-based locking. So far, we have never seen proper locking under MySQL but we should try the above argument with File.
Best regards and thankyou for your thoughts on this, it has been a stress for us... I will report back with the outcomes,
Kind regards,
Craig.
| [reply] |
Nay, Transaction=>1 and Lock::File does not solve our problem. Using Session code without session manager did not lock either as you can see from our code (above).
This has got to be something stupidly obvious...
We are now digging harder into our code base as we are sure it has to be us. The example above must also have our problem though!
cheers
| [reply] |
You problem is one of design (you've designed a race codition).
Session managment is not a magic cure,
and neither is testing. Rework your logic.
| [reply] |