[imp] Log errors with memcached sessions
Sebastián Calero
scalero at datadec.es
Mon Nov 14 00:24:09 PST 2005
Follows this issue in the horde list now like Jan Schneider advise us.
I try your patch but doesn´t work with PEAR_LOG_DEBUG that I now use for testing memcached, It isn't sufficient and to work this properly I use this code:
106c106
< Horde::logMessage('Wrote session data (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_DEBUG);
---
> // Horde::logMessage(sprintf("Wrote session data (id = %s)", (string)$id), __FILE__, __LINE__, PEAR_LOG_DEBUG);
189c189
< 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);
If I comment the 'Horde::logMessage' in 'write' and '_getConForId' functions all works nice.
Greetings and thanks for the answer.
Sebastian Calero.
-----Mensaje original-----
De: imp-bounces at lists.horde.org en nombre de Kevin M. Myer
Enviado el: sáb 12/11/2005 1:11
Para: imp at lists.horde.org
CC:
Asunto: Re: [imp] Log errors with memcached sessions
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
--
IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: imp-unsubscribe at lists.horde.org
More information about the imp
mailing list