P
PerlGuy
Solved this once years ago and completely forgot the solution. Here's
the setup:
mod_perl2, Apache 2, Apache::Session::MySQL, ModPerl::Registry, and
Apache:BI
Each script uses Apache::Session::MySQL to get a session and or write
back to the existing session. Apache::Session::Lock::MySQL issues
locks to the database with a GET_LOCK and RELEASE_LOCK statement.
Under normal circumstances there is no problem. However, if we double
click a "submit" button on a Web page or in some other way get two of
the Apache mod_perl processes to be making requests using the same
session at the same time, then we get into a lock condition. MySQL
database shows User Lock states for the processes that are stuck in a
lock:
SELECT GET_LOCK('Apache-Session-4a3a60b7ec332a2de29dd95081c4406a',
3600)
Essentially those apache processes are hosed since they keep a
consistent DB connection with Apache:BI
The button must really be "double-clicked" quickly to get this
effect. The first time a process is started and it grabs the lock.
The process does not complete -- it's like it is interrupted. The
second one makes any updates to the database. Only solution I've come
up with so far is to modify the lock time in
Apache::Session::Lock::MySQL down to something like 10 seconds which
is still 10x longer than any script will ever take.
What's the solution?
the setup:
mod_perl2, Apache 2, Apache::Session::MySQL, ModPerl::Registry, and
Apache:BI
Each script uses Apache::Session::MySQL to get a session and or write
back to the existing session. Apache::Session::Lock::MySQL issues
locks to the database with a GET_LOCK and RELEASE_LOCK statement.
Under normal circumstances there is no problem. However, if we double
click a "submit" button on a Web page or in some other way get two of
the Apache mod_perl processes to be making requests using the same
session at the same time, then we get into a lock condition. MySQL
database shows User Lock states for the processes that are stuck in a
lock:
SELECT GET_LOCK('Apache-Session-4a3a60b7ec332a2de29dd95081c4406a',
3600)
Essentially those apache processes are hosed since they keep a
consistent DB connection with Apache:BI
The button must really be "double-clicked" quickly to get this
effect. The first time a process is started and it grabs the lock.
The process does not complete -- it's like it is interrupted. The
second one makes any updates to the database. Only solution I've come
up with so far is to modify the lock time in
Apache::Session::Lock::MySQL down to something like 10 seconds which
is still 10x longer than any script will ever take.
What's the solution?