php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57189 setting value works, but memcache_set fails
Submitted: 2006-08-20 02:32 UTC Modified: 2006-09-06 07:46 UTC
From: clay at killersoft dot com Assigned:
Status: Not a bug Package: memcache (PECL)
PHP Version: 5.2.0 RC1 OS: Mac OS X
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: clay at killersoft dot com
New email:
PHP Version: OS:

 

 [2006-08-20 02:32 UTC] clay at killersoft dot com
Description:
------------
Running the example.php script from the package distribution 
returns:

(bool) false
(bool) false
(bool) false

When running example.php with memcached running as non-
daemon in -vv mode, I see this:

<3 server listening
<5 new client connection
<5 set str_key 0 0 28
>5 STORED
<5 connection closed.

I am running memcached 1.1.12 and libmemcache-1.4.0rc2.

As mentioned above, memcached appears to be accepting a 
connection without a problem, and successfully storing the 
first value. However, the immediate closure of the 
connection is perhaps what is causing example.php to fail.

Reproduce code:
---------------
See example.php in package distribution

Expected result:
----------------
string(28) "String to store in memcached"
int(123)
object(stdClass)#2 (1) {
  ["attribute"]=>
  string(4) "test"
}

Actual result:
--------------
(bool) false
(bool) false
(bool) false



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-21 04:10 UTC] tony2001 at phpclub dot net
>memcached 1.1.12 and 
Please downgrade memcached to the previous version, this version is known to have protocol violations.

>libmemcache-1.4.0rc2.
Erm.. Are you sure you are using PECL/memcache?
If so, why do you mention libmemcache, which has nothing to do with this extension?
 [2006-08-21 04:39 UTC] clay at killersoft dot com
>Please downgrade memcached to the previous
>version, this version is known to have protocol
>violations.

I followed this suggestion, and the same behavior persists. I also upgraded to memcached-1.1.13-pre2, which also has the same issues.

Can you provide more information (a link?) regarding the 1.1.12 protocol violation bugs? I couldn't find anything about that, and the 1.1.13-pre2 ChangeLog doesn't mention fixing any protocol violations either ... so it may be worth escalating this to Brad Fitzpatrick to resolve these issues in 1.1.13.

>Erm.. Are you sure you are using PECL/memcache?
>If so, why do you mention libmemcache, which has
>nothing to do with this extension?

Ah, sorry about that -- have all my memcache related libs downloaded to one source dir, and forgot that only lighttpd is using libmemcache. Please disregard.
 [2006-08-21 05:11 UTC] mikael at synd dot info
The connection shouldn't be disconnected until script shutdown. If for some reason the server closes the connection immediatly after the first set() as your trace indicates, futher calls to set() and get() should and will indeed fail (and returning false.) 

Running example.php against memcached 1.1.12 using -vv output the expected values and produces as trace as:

<3 server listening
<7 new client connection
<7 set str_key 0 0 28
>7 STORED
<7 set num_key 0 0 3
>7 STORED
<7 set obj_key 1 0 46
>7 STORED
<7 set arr_key 1 0 44
>7 STORED
<7 get str_key
>7 sending key str_key
>7 END
<7 get num_key
>7 sending key num_key
>7 END
<7 get obj_key
>7 sending key obj_key
>7 END
<7 connection closed.

The question is then why your server closes the connection unexpectedly after the first set()? Could it be some OSX or PHP 5.2 related issue?

//Mikael
 [2006-08-23 04:11 UTC] clay at killersoft dot com
It appears that this is specifically an issue related to ext/memcache (or memcached itself) on Mac OS X.

I ran example.php this evening on my CentOS 4 server with ext/memcache 2.0.4 and memcached 1.1.12, and it ran as expected without errors.

What information can I provide to help determine where the issue is (and with which package) on Mac OS X?
 [2006-08-24 04:02 UTC] mikael at synd dot info
First verify whether the problem lies in memcached itself or pecl/memcache by telnetting (e.g. "telnet localhost 11211") to the deamon and issuing the commands:

set str_key 0 0 28
String to store in memcached

The server should then respond with "STORED" and, if the problem lies with memcached itself, close the connection (whereby telnet outputs "Connection closed by foreign host.")

If the problem lies with memcached you should contact the package maintainer and possibly the memcached mailing list (memcached@lists.danga.com). You might want to attach a trace by starting memcached like "strace memcached -u nobody -l 127.0.0.1 -p 11211" with the telnet session running from another terminal.

However, if the problem lies with pecl/memcache please attach a trace by running example.php like "strace php example.php"

//Mikael
 [2006-09-06 07:37 UTC] marco at kaywa dot com
I had exactly the same issue (on PHP 5.1.2, Mac OS X 10.4.7)
Recompiling memcached after applying the patches described in this build-script fixed the problem for me.

http://topfunky.net/svn/shovel/memcached/install-memcached.sh
 [2006-09-06 07:46 UTC] mikael at synd dot info
Seems like this is a problem with memcached itself (judging by the last comment by marco at kaywa dot com) which should be brought to the memcached mailing list instead.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 05:01:31 2024 UTC