[imp] Log errors with memcached sessions
Kevin M. Myer
kevin_myer at iu13.org
Fri Nov 11 16:11:07 PST 2005
Quoting "Kevin M. Myer" <kevin_myer at iu13.org>:
> This is very interesting. I'm the one that added the log messages and
> I had the same observation that you did, which amounts to Apache
> segfaulting sporadically. The only difference I could really see
> between working code and not working code was the log messages (I was
> comparing two slightly different iterations of the code) but I couldn't
> see how having them present would cause segfaults. I'll try to figure
> it out tonight. Someone who knows PHP innards better than I care to
> offer an explanation for this?
Alright, I think I found at least a consistent and somewhat logical
explanation to this. The segfault appears to be triggered by the
private function _getConForId if you have your log level set to
LOG_DEBUG. If you have it set to anything lower than that (which would
prevent Horde::logMessage from being called), no segfault. This
explains why the issue was sporadic for me, as I'd be switching between
machines or configs that had different log levels set. If you change
that log level to LOG_NOTICE, Apache will segfault, and if you replace
the log message with anything, it also segfaults, as I was thinking
that maybe it couldn't handle a function call properly in the middle of
a Horde::logMessage call.
Try this patch and see if the error goes away for you.
--- memcached.php 17 Oct 2005 20:56:51 -0000 1.11
+++ memcached.php 12 Nov 2005 00:08:57 -0000
@@ -186,7 +186,7 @@
{
$hashCode = abs((crc32($id) >> 16) & 0x7fff);
if (($ns = count($this->_db)) > 0) {
- Horde::logMessage('Using connection ' . ($hashCode % $ns)
. ' for id = ' . $id, __FILE__, __LINE__, PEAR_LOG_DEBUG);
+// Horde::logMessage('Using connection ' . ($hashCode %
$ns) . ' for id = ' . $id, __FILE__, __LINE__, PEAR_LOG_DEBUG);
return $this->_db[$hashCode % $ns];
} else {
Horde::fatal(PEAR::raiseError('No connections available
for memcached SessionHandler.'), __FILE__, __LINE__);
Kevin
--
Kevin M. Myer
Senior Systems Administrator
Lancaster-Lebanon Intermediate Unit 13 http://www.iu13.org
More information about the imp
mailing list