Phoenix.pm: Apache::Session::Lock::File under mod_perl

Doug Miles doug.miles at bpxinternet.com
Thu Jan 16 11:04:05 CST 2003


Scott Walters wrote:
>>Doug incantonated: 
>>Did you dive into the code any to see what the problem was?  I'm trying 
>>to decide if it's worth the effort.
> 
> 
> No. I opened it in vi once and noticed that it was a few thousands more
> lines that it should be. I sighed and decided it would be easier to replace
> it than try to fix, undestand, clean, or decruft it. Hrm. I should write a 
> module that takes another module and puts it through the unit tests
> taking out each line of code one by one. Each line that can be removed
> will be removed, and the module output in its new, decrufted form. Not
> as good as a hand polish job, but it'd be interesting to see how much
> the average module reduces. Reading most peoples code, lines that don't
> do anything are scattered all over the place. Anyway, in all seriousness,
> require, flock/SQL's lock row, and Storable worked fine, and is essentially
> what Apache::Session is doing under all of the cruft anyway. Perl has
> SYSV SHM primitives built in, but I recommend against this -  a core fault
> or incomplete exception handling code could leave the semaphore stuck. 
> You'll have to write a little object wrapper if you want to release the
> lock based on scope...
> 
> -scott

OK, thanks!  I'll probably write my own too...  I'm just surprised that 
I couldn't find more about it on Google groups. :(

> 
> 
> 
>>
>>
>>Scott Walters wrote:
>>
>>>Ahhh, I distinctly remember the 18th time that Apache::Session failed on
>>>Contact Designs. We were sitting in our attorney's office in a downtown
>>>Phoenix highrise, arbitrating with an non-paying client who was alleging
>>>that we didn't have the experience needed to write an e-commerce site,
>>>so they could step out of the contract and use Yahoo! sites, which look
>>>like garbage - this after cating to demand after demand by this client.
>>>Laptop and Ricochet wireless Internet on the confrence table, I prepare
>>>to demonostrate the check out process on another clients site - when
>>>Apache::Session decides that another processes hasn't released the SHM 
>>>lock. 
>>>
>>>This is an absolutely true story. Apache::Session caused constant
>>>problems in each of its modes - locking on SHM, locking on a database,
>>>serializing to file, serializing to database, etc. 
>>>
>>>I've flamed Apache::Session in this channel before, and I'll do it again.
>>>Use require, flock, and Storable, just like God intended. 
>>>
>>>Apache::Session is one of those things that looks cool, but fails
>>>erratically under real-world conditions.  Sorry to be patronizing, but I told 
>>>you so, nanana!
>>>
>>>-scott
>>>
>>
>>>>Anyone out there using Apache::Session::File and 
>>>>Apache::Session::Lock::File under mod_perl?  The problem I am having is 
>>>>that Apache::Session::Lock::File is aparently not releasing the 
>>>>exclusive lock when the tied hash goes out of scope.  I can get a simple 
>>>>test program to work from the command line, but when I try it under 
>>>>mod_perl, it locks on the tie to the existing session.  If I delete the 
>>>>lock file, it works fine.  Any ideas?
>>>>
>>>>
>>>
>>>
>>>
>>
>>
> 
> 





More information about the Phoenix-pm mailing list