You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rob Bloodgood <ro...@empire2.com> on 2002/08/24 02:44:23 UTC
[OT] Apache::Session and Win32
I had some work to do for my friend on a Win2K/IIS box (yes, NOT apache)
(yes, it made me shudder). I decided to base the program on
CGI::Application, using Apache::Session to string things together.
Wow.
I tried Apache::Session::File, but after MUCH hair-pulling it seems that the
Lock mechanism is COMPLETELY hosed (things are either never locked or never
unlocked, or something...)
Then I tried Apache::Session::DB_File but I never EVER saw a db file
created.
Finally, after realizing that Lock'ing was where I was hurting, I tried
::Flex with a File store but Null locking (the app is low-traffic enough
that I may or may not survive that decision). This was where I found out
that Directory => "C:/WINNT/Temp" is a bad idea. I could never figure out
why, it just didn't work.
Finally, I created and used "C:/tmp/sessions" (again, with no locking), and
Viola! I have sessions!
So my question is, what should I have done differently? Is ::Lock::Null a
guarantee of corruption/explosion on the first day I get 10 hits? Or is
DB_File the preferred choice but the PPM at Randy Kobes' repository broken
(hypothetical, I'm just throwing out maybe's)?
I managed to find a "working" solution but it was *NOT* worth the several
hours it took, and still feels dirty.
Any suggestions welcome!
L8r,
Rob
P.S. If this is too OT for comfort, I can take this to email or whatever...
I just happen to know the highest concentration of Apache::Session users in
the world are people on THIS list. Ask the questions where you MIGHT get an
answer, no? :-)
Re: [OT] Apache::Session and Win32
Posted by Perrin Harkins <pe...@elem.com>.
Rob Bloodgood wrote:
>I tried Apache::Session::File, but after MUCH hair-pulling it seems that the
>Lock mechanism is COMPLETELY hosed (things are either never locked or never
>unlocked, or something...)
>
>
AFAIK, Win32 has no flock.
>Finally, after realizing that Lock'ing was where I was hurting, I tried
>::Flex with a File store but Null locking (the app is low-traffic enough
>that I may or may not survive that decision).
>
Null locking is fine with anything that can do atomic updates on its
own, i.e. not with DB_File.
>So my question is, what should I have done differently?
>
You should probably use MySQL. It runs fine on Win32.
> Is ::Lock::Null a
>guarantee of corruption/explosion on the first day I get 10 hits?
>
With a storage system that does atomic writes, corruption isn't an issue
-- the lock is only to prevent lost updates. Those are not really an
issue in most session scenarios, where "last save wins" is typically
good enough. I can't remember if the File store uses the atomic rename
trick or not. If it doesn't, you could be in trouble with that.
DB_File definitely doesn't. That leaves MySQL, which does atomic writes.
>I just happen to know the highest concentration of Apache::Session users in
>the world are people on THIS list.
>
There are many on perlmonks.org as well.
- Perrin