error after resetting servers and trying to add new ones

Bug #1154159 reported by Wojtek
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
libmemcached
New
Undecided
Unassigned
libmemcached (Gentoo Linux)
Fix Released
Medium

Bug Description

I'm using PHP memcached extension (master branch of git://github.com/php-memcached-dev/php-memcached.git) . When compiled with 1.0.15 and resetting servers list and reading new servers works fine, but when compiled with 1.0.16 PHP dies without errors or stack trace :(

resetServers uses:
memcached_servers_reset(m_obj->memc);

addServers uses:
memcached_server_list_append_with_weight(list, host, port, weight, &status);
memcached_server_push(m_obj->memc, list);
memcached_server_list_free(list);

I didn't have time to debug any further ... sorry

Revision history for this message
Wojtek (woledzki) wrote :

Just to add some more - I'm using persistent memcached connenction

Wojtek (woledzki)
description: updated
Revision history for this message
Brian Aker (brianaker) wrote :

Thanks, I am looking into this.

Revision history for this message
Timon (timosha-l) wrote :

test for this issue

Revision history for this message
Adam Saponara (as-v) wrote :

Fix + test for this issue attached

Revision history for this message
Timon (timosha-l) wrote :

cool, latest patch works fine for 1.0.18, tested in production

Revision history for this message
In , Mattsch (mattsch) wrote :

=dev-libs/libmemcached-1.0.18-r2 segfaults with the OPT_LIBKETAMA_COMPATIBLE enabled and a call to addServer, then resetServerList and another call to addServer.

Reproducible: Always

Steps to Reproduce:
Example of how to reproduce in php (using pecl-memcached):

<?php
$host = 'localhost';
$port = '11211';
$weight = null;
$m = new Memcached('test');
$m->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);

var_dump($m->addServer($host, $port, $weight));
var_dump($m->resetServerList());
var_dump($m->addServer($host, $port, $weight));
var_dump($m->getServerList());
?>

Actual Results:
segfault

Expected Results:
A call to addServer after resetServerList should not cause a segfault

Revision history for this message
In , Mattsch (mattsch) wrote :

Created attachment 400200
libmemcached-1.0.18-patch-continuum.patch

Patch from the launchpad bug report.

Revision history for this message
In , Bircoph-4 (bircoph-4) wrote :

Please upload your emerge --info.

Revision history for this message
In , Mattsch (mattsch) wrote :
Download full text (9.3 KiB)

emerge --info
Portage 2.2.17 (python 3.4.1-final-0, default/linux/amd64/13.0, gcc-4.8.4, glibc-2.20-r2, 3.19.3-gentoo x86_64)
=================================================================
System uname: Linux-3.19.3-gentoo-x86_64-Intel-R-_Core-TM-_i7-4700MQ_CPU_@_2.40GHz-with-gentoo-2.2
KiB Mem: 16365672 total, 14532780 free
KiB Swap: 0 total, 0 free
Timestamp of repository gentoo: Thu, 02 Apr 2015 14:15:01 +0000
sh dash 0.5.7.4
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash: 4.2_p53::gentoo
dev-java/java-config: 2.2.0::gentoo
dev-lang/perl: 5.20.1-r4::gentoo
dev-lang/python: 2.7.9-r1::gentoo, 3.4.1::gentoo
dev-util/cmake: 2.8.12.2-r1::gentoo
dev-util/pkgconfig: 0.28-r1::gentoo
sys-apps/baselayout: 2.2::gentoo
sys-apps/openrc: 0.13.11::gentoo
sys-apps/sandbox: 2.6-r1::gentoo
sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo
sys-devel/automake: 1.11.6-r1::gentoo, 1.13.4::gentoo
sys-devel/binutils: 2.24-r3::gentoo
sys-devel/gcc: 4.8.4::gentoo
sys-devel/gcc-config: 1.7.3::gentoo
sys-devel/libtool: 2.4.6::gentoo
sys-devel/make: 4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc: 2.20-r2::gentoo
Repositories:
                                                                                                                                                                                                    ...

Read more...

Revision history for this message
In , Matthew Thode (prometheanfire) wrote :

fixed in 1.0.18-r3

Revision history for this message
Matthew Thode (prometheanfire) wrote :

works for us as well

Changed in libmemcached (Gentoo Linux):
importance: Unknown → Medium
status: Unknown → Fix Released
Revision history for this message
Ryan Gordon (ryan-5) wrote :

Would it be possible to apply this patch to mainline libmemcached in a 1.0.19 release? This is affecting us too, running CentOS 7.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.