Closed
Description
Looking at the lsof listing of the apache2 process the port number changes after every request to that process:
apache2 930 www-data 12u IPv4 125149 0t0 TCP 127.0.0.1:34156->127.0.0.1:11211 (ESTABLISHED)
apache2 930 www-data 12u IPv4 169421 0t0 TCP 127.0.0.1:34204->127.0.0.1:11211 (ESTABLISHED)
apache2 930 www-data 12u IPv4 169453 0t0 TCP 127.0.0.1:34228->127.0.0.1:11211 (ESTABLISHED)
so the persistence is not working as expected since the old TCP connection is dropped and a new one created for each PHP request being handled.
Setting memcached.sess_binary_protocol = Off fixes the problem and the TCP connections are retained between requests.
The problem seems to be that setting the binary protocol kills existing connections:
PS_OPEN_FUNC(memcached)
....
memc = (memcached_st *) le_p->ptr;
if (!s_configure_from_ini_values(memc, 1)) {
...
zend_bool s_configure_from_ini_values(memcached_st *memc, zend_bool silent)
...
if (MEMC_SESS_INI(binary_protocol_enabled)) {
check_set_behavior(MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
}
...
memcached_return_t memcached_behavior_set(memcached_st *shell,
const memcached_behavior_t flag,
uint64_t data)
....
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
send_quit(ptr); // We need t shutdown all of the connections to make sure we do the correct protocol
....
Since setting some options closes the existing connection the solution might be to first get the current behavior with memcached_behavior_get and only call memcached_behavior_set if the value is not as expected?
Metadata
Metadata
Assignees
Labels
No labels