Closed m6w6 closed 4 years ago
Just to add some more - I'm using persistent memcached connenction
cool, latest patch works fine for 1.0.18, tested in production
=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
Created attachment 400200 libmemcached-1.0.18-patch-continuum.patch
Patch from the launchpad bug report.
System uname: Linux-3.19.3-gentoo-x86_64-Intel-R-_Core-TM-_i7-4700MQCPU@_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:
gentoo
location: /usr/portage
sync-type: rsync
sync-uri: rsync://rsync.namerica.gentoo.org/gentoo-portage
priority: -1000
x-portage location: /usr/local/portage masters: gentoo priority: 0
grub2-themes location: /var/lib/layman/grub2-themes sync-type: laymansync sync-uri: https://github.com/gentoo/grub2-themes-overlay.git masters: gentoo priority: 50
sunrise location: /var/lib/layman/sunrise sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/sunrise-reviewed.git masters: gentoo priority: 50
ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=core-avx2 -O2 -pipe -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.2/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.2/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.2/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=core-avx2 -O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://portage.home http://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/ http://mirror.phy.olemiss.edu/mirror/gentoo" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j9" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/tmp" USE="X a52 aac acl acpi adns ads aes alsa amd64 apache2 apm audiofile avi avx avx2 bcmath bdf berkdb bluetooth bzip2 cairo calendar caps cdda cdr chardet cjk cli consolekit cracklib crypt css ctype cups curl curlwrappers cxx dbus declarative device-mapper dga dhcp directfb dri dts dvb dvd dvdread egl enca encode exif fbcon ffmpeg flac fma3 fontconfig foomaticdb fortran ftp fts3 gd gdbm gif git gmp gpm gsm gstreamer gtk gtk2 gzip hal hash hbci hls iconv icu ieee1394 imagemagick imap imlib innodb iproute2 ipv6 java java6 javascript jpeg jpeg2k json kde keymap kipi lcms libcaca libkms libnotify lm_sensors logrotate lzma lzo mad matroska mcal mhash mime mjpeg mms mmx mmxext mng modules mp3 mp4 mpeg mplayer msession multilib mysql mysqli mythtv ncurses network nls nptl nptlonly nsplugin nss ntp nvidia offensive ofx ogg openal opengl openmp osc osmesa oss pam pcntl pcre pdf pdo pear perl pgo php png policykit popcnt posix postproc ppds python qt qt3 qt3support qt4 quicktime readline real reflection rtc samba sasl scanner sdl semantic-desktop session simplexml soap sockets spell spl sql sqlite sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 subversion suhosin svg syslog system-cairo system-icu system-jpeg system-libvpx system-sqlite tcpd theora thumbnail tidy tiff tokenizer transcode truetype tslib udev unicode usb utempter v4l v4l2 vaapi vcd vdpau vorbis vpx wddx webkit x264 xcb xcomposite xine xinerama xml xmp xpm xsl xv xvfb xvid xvmc zip zlib" ABI_X86="32 64" ALSA_CARDS="hda-intel" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc efi-64" INPUT_DEVICES="evdev tslib" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en ru" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-2 php5-4 php5-5 php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel i965 nvidia modesetting" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
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.
Imported from Launchpad using lp2gh.
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