On Mon, Jan 07, 2002 at 11:08:56PM -0800, Jarrod Stenberg wrote:
> I use "MySQL Semaphore" for EMBPERL_SESSION_CLASSES.
> I'm actually suspicious of using Semaphore locking a
> bit, but I guess I don't exactly get IPC right now and
> so I don't know where to look for trouble. A moment
> ago, I moved this to mysql locking. We'll see if this
> does it.
if it does fix it, i'd be very interested.
while debugging lockups in a file/semaphore setup, I was very
suspicious of the semaphore hashing done by
Apache::Session::Lock::Semaphore.
since there are a limited number of semaphores, Lock::Semaphore does a
hash on the session id to work out which semaphore to use.
(if you want to use > 16 (32 on linux) semaphores, you'll need to pass
a larger NSems arg to Lock::Semaphore btw - see the code).
in the lockup cases i was getting, the %udat session id and the
%mdat file name both hashed to the same semaphore. so when Embperl
requests a write lock on both sessions ...
i was in a hurry, switched back to file locking (only a devel setup)
and stopped thinking about it at that point.
i presume its ok, otherwise there'd be lots more reports of lockups
using semaphore locking. guess i have to think about it harder ;)
> BTW, none of this generates errors.
(aside)
if its an os lockup issue (or a livelock thats making syscalls),
strace(1)ing the apache process is usually very useful. eg: a
semaphore lockup will show clearly as a process blocking on semop(2).
found a great tip for debugging perl server spins in the section on
"spinning httpds" in mod_perl(3pm) (only use SIGUSR2, not SIGUSR1 -
apache uses SIGUSR1 for graceful restarts, iirc):
spinning httpds
To see where an httpd is "spinning", try adding this
to your script or a startup file:
use Carp ();
$SIG{'USR2'} = sub {
Carp::confess("caught SIGUSR2!");
};
Then issue the command line:
kill -USR2 <spinning_httpd_pid>
> So it's two problems: stalls and memory leak-like
> behavior. They don't exactly seem related but could
> be.
for a graceful way to deal with Embperl's unbounded caching, see
Apache::SizeLimit.
i use this:
<Perl>
use Apache::SizeLimit;
$Apache::SizeLimit::MAX_PROCESS_SIZE = 15*1024; # kb -> 15Mb
$Apache::SizeLimit::CHECK_EVERY_N_REQUESTS = 5;
$PerlCleanupHandler = 'Apache::SizeLimit';
</Perl>
you will probably want to raise MAX_PROCESS_SIZE.
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]