Skip to content

if addServers too much server, and OPT_LIBKETAMA_COMPATIBLE is true, core dump will appear #407

Description

@khadgarmage

hi, @sodabrew if addServers too much server, and OPT_LIBKETAMA_COMPATIBLE is true, core dump will appear
PHP env:
PHP 5.3.29 or PHP 5.5.15
Reproduce:

<?php
$mem=new Memcached();
$servers = array (
        array ( 'host' => '10.13.81.227', 'port' => 11211 ),
        array ( 'host' => '10.13.81.227', 'port' => 11212 ),
        array ( 'host' => '10.13.81.227', 'port' => 11213 ),
        array ( 'host' => '10.13.81.155', 'port' => 11211 ),
        array ( 'host' => '10.13.81.155', 'port' => 11212 ),
        array ( 'host' => '10.13.81.155', 'port' => 11213 ),
        array ( 'host' => '10.13.81.231', 'port' => 11211 ),
        array ( 'host' => '10.13.81.231', 'port' => 11212 ),
        array ( 'host' => '10.13.81.231', 'port' => 11213 ),
        array ( 'host' => '10.13.81.125', 'port' => 11211 ),
        array ( 'host' => '10.13.81.125', 'port' => 11212 ),
        array ( 'host' => '10.13.81.125', 'port' => 11213 ),
        array ( 'host' => '10.13.81.13', 'port' => 11211 ),
        array ( 'host' => '10.13.81.13', 'port' => 11212 ),
        array ( 'host' => '10.13.81.13', 'port' => 11213 ),
        array ( 'host' => '10.13.81.92', 'port' => 11211 ),
        array ( 'host' => '10.13.81.92', 'port' => 11212 ),
        array ( 'host' => '10.13.81.92', 'port' => 11213 ),
        array ( 'host' => '10.13.81.209', 'port' => 11211 ),
        array ( 'host' => '10.13.81.209', 'port' => 11212 ),
        array ( 'host' => '10.13.81.209', 'port' => 11213 ),
        array ( 'host' => '10.13.81.177', 'port' => 11211 ),
        array ( 'host' => '10.13.81.177', 'port' => 11212 ),
        array ( 'host' => '10.13.81.177', 'port' => 11213 ),
        array ( 'host' => '10.13.81.70', 'port' => 11211 ),
        array ( 'host' => '10.13.81.70', 'port' => 11212 ),
        array ( 'host' => '10.13.81.70', 'port' => 11213 ),
);
$mem->addServers($servers);
$mem->setOption(Memcached::OPT_DISTRIBUTION,Memcached::DISTRIBUTION_CONSISTENT);
$mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$mem->set('name',"testdfdsafdsafdsafda",15);
echo $mem->get('name');

Result On cli:

[ffs-amazon-web root@ip-10-13-80-98 ~]# php t.php
*** glibc detected *** php: double free or corruption (out): 0x000000000132c210 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3fca275e76]
/lib64/libc.so.6[0x3fca2789b3]
/lib64/libc.so.6(qsort_r+0x2a8)[0x3fca234f38]
/usr/lib/libmemcached.so.11(+0x15812)[0x7fd6743c4812]
/usr/lib64/php/modules/memcached.so(+0x79ef)[0x7fd6745e79ef]
/usr/lib64/php/modules/memcached.so(+0x7bc7)[0x7fd6745e7bc7]
php[0x63eef3]
php(execute_ex+0x38)[0x6307a8]
php(zend_execute_scripts+0x18c)[0x5bbbdc]
php(php_execute_script+0x1f0)[0x55c5c0]
php[0x66d233]
php[0x66da38]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x3fca21ed5d]
php[0x422939]
======= Memory map: ========
00400000-00754000 r-xp 00000000 ca:01 148069                             /usr/bin/php
00954000-009e8000 rw-p 00354000 ca:01 148069                             /usr/bin/php
009e8000-00a03000 rw-p 00000000 00:00 0
00de7000-00df2000 rw-p 003e7000 ca:01 148069                             /usr/bin/php
01033000-01353000 rw-p 00000000 00:00 0                                  [heap]
391fa00000-391fa1d000 r-xp 00000000 ca:01 237783                         /lib64/libselinux.so.1
391fa1d000-391fc1c000 ---p 0001d000 ca:01 237783                         /lib64/libselinux.so.1
391fc1c000-391fc1d000 r--p 0001c000 ca:01 237783                         /lib64/libselinux.so.1
391fc1d000-391fc1e000 rw-p 0001d000 ca:01 237783                         /lib64/libselinux.so.1
391fc1e000-391fc1f000 rw-p 00000000 00:00 0
391fe00000-391fe22000 r-xp 00000000 ca:01 239044                         /lib64/libncurses.so.5.7
391fe22000-3920021000 ---p 00022000 ca:01 239044                         /lib64/libncurses.so.5.7
3920021000-3920022000 rw-p 00021000 ca:01 239044                         /lib64/libncurses.so.5.7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions