Giter Club home page Giter Club logo

libmemcached's Introduction

libmemcached-awesome

License Badge

libmemcached-awesome is an open source C/C++ client library and tools for the memcached server (http://memcached.org/). It has been designed to be light on memory usage, thread safe, and provide full access to server side methods.

NOTE:
This is a resurrection of the original work from Brian Aker at libmemcached.org.

Documentation

Docs Actions Badge

See https://awesomized.github.io/libmemcached

Building and updating docs

See gh-pages/publish script and the docs-publish-pages workflow, which automate pushing updated documentation to github pages.

Installing

libmemcached-awesome uses CMake. Please see/edit CMakeConfig.txt or use ccmake(1) or cmake-gui(1) to set any preferred options.

From source

git clone github.com:awesomized/libmemcached
mkdir build-libmemcached
cd $_
cmake ../libmemcached
make
sudo make install

Requirements

  • CMake 3.9+
  • C++11 compiler
  • GNU Bison 2.3+ and Flex
Optional dependencies
  • C++17 compiler (required for: tests)
  • Intel's libtbb (optional for: tests; for GCC's stdlib parallelism support)
  • pthreads (required for: tests, contrib/bin/memaslap, libmemcachedutil/pool)
  • libevent (required for: contrib/bin/memaslap)
  • Cyrus' libsasl2 (required for: libmemcached/sasl)

Binaries

CI and release builds for Linux, a couple BSDs, MacOS and Windows are available at https://artifacts.m6w6.name/libmemcached/ and rsync://m6w6.name::artifacts/libmemcached/.

Testing

Enable the BUILD_TESTING setting for a build and run make test.

cmake -DBUILD_TESTING=ON ../libmemcached
make test

Continuous integration

Actions Badge Sourcehut Badge

CI/Testing is performed on the following system matrix:

OS Compiler Arch Comments
Linux GNU 7/9/10, Clang 9/10/11/12 amd64 sasl, coverage, sanitizers
MacOS AppleClang 12 amd64 sasl, coverage
FreeBSD Clang 11 amd64 sasl, coverage
OpenBSD Clang 10 amd64 sasl, coverage
Windows MSVC 16, MinGW amd64 no sasl, no tests
Solaris SunPro 12.5 amd64 no sasl, no tests, manually

libmemcached-awesome has been tested against [memcached](https://github. com/memcached/memcached) v1.5 and v1.6.

ChangeLog

Check out the latest releases or the bundled ChangeLog for a comprehensive list of changes.

License

libmemcached-awesome is licensed under the 3-Clause-BSD license, which can be found in the accompanying LICENSE file.

Contributing

Please report any issues on the bug tracker.

A list of known permanent issues is maintained in BUGS.

All forms of contribution are welcome! Please see the bundled CONTRIBUTING note for the general principles followed.

The list of current and past maintainers and contributors is available in AUTHORS.

libmemcached's People

Contributors

adsr avatar athomason avatar brianaker avatar capttofu avatar cghawthorne avatar chenyin avatar dustin avatar edevil avatar elambert avatar emonty avatar fallenpegasus avatar gitter-badger avatar hussainnaqvee avatar m6w6 avatar mattknox avatar mkevac avatar piotrsikora avatar poison avatar posulliv avatar remicollet avatar steveyen avatar stewartsmith avatar tangentci avatar timbunce avatar tomaskorbar avatar trondn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

libmemcached's Issues

-floop-parallelize-all leads to build failures on some platforms

Imported from Launchpad using lp2gh.


Debian bug for gcc-4.7: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721720

RT bug for Memcached::libmemcached: https://rt.cpan.org/Public/Bug/Display.html?id=88378

Travis-ci build failure caused by this: https://travis-ci.org/timbunce/Memcached-libmemcached/jobs/11910811

Some way to disable -floop-parallelize-all via configure would be appreciated.

Handle connect() returning EINPROGRESS

Imported from Launchpad using lp2gh.


libmemcached is returning errors with errno set to EINPROGRESS. From the connect() man page:

   EINPROGRESS
          The socket is nonblocking and the connection cannot  be  completed  immediately.   It  is  possible  to
          select(2)  or  poll(2)  for  completion by selecting the socket for writing.  After select(2) indicates
          writability, use getsockopt(2) to read the SO_ERROR option at level  SOL_SOCKET  to  determine  whether
          connect()  completed  successfully  (SO_ERROR  is zero) or unsuccessfully (SO_ERROR is one of the usual
          error codes listed here, explaining the reason for the failure).

So, EINPROGRESS should never cause an error that the user sees. Instead, it should be handled by libmemcached (and errno set back to zero).

revno: 895 make ignores configure "--with-libsasl2-prefix" if "--prefix" set

Imported from Launchpad using lp2gh.


AudioZeus:libmemcached brad$ config/autorun.sh 
config/autorun.sh: running `/opt/local/bin/glibtoolize --automake --copy --force' 
config/autorun.sh: running `/opt/local/bin/aclocal-1.11 -I m4' 
config/autorun.sh: running `/opt/local/bin/autoheader' 
config/autorun.sh: running `/opt/local/bin/automake-1.11 --add-missing --copy --force --foreign' 
configure.ac:14: installing `config/compile'
configure.ac:14: installing `config/config.guess'
configure.ac:14: installing `config/config.sub'
configure.ac:14: installing `config/install-sh'
configure.ac:14: installing `config/missing'
Makefile.am: installing `config/depcomp'
config/autorun.sh: running `/opt/local/bin/autoconf' 

Configured with the following tools:

  • libtoolize (GNU libtool) 2.2.10
  • aclocal (GNU automake) 1.11.1
  • autoheader (GNU Autoconf) 2.67
  • automake (GNU automake) 1.11.1
  • autoconf (GNU Autoconf) 2.67

AudioZeus:libmemcached brad$ ./configure --prefix=/opt/local --with-libsasl2-prefix=/usr 2>&1 | grep sasl
checking for libsasl... no
checking for libsasl2... yes
checking how to link with libsasl2... /usr/lib/libsasl2.dylib
AudioZeus:libmemcached brad$ make 2>&1 | grep /opt/local/include/sasl/sasl.h
/opt/local/include/sasl/sasl.h:349: warning: function declaration isn't a prototype
AudioZeus:libmemcached brad$

[patch included] libmemcached exhibits odd behaviour on TCP connection close

Imported from Launchpad using lp2gh.


I created a libmemcached client connection to a memcached server over TCP. This connection was long-lived and infrequently used. At some point, my memcached server was restarted, which caused it to close the libmemcached connection with a TCP FIN, which was ACKed.

A short while later (when the memcached server was back up and running), I tried to send a request over the libmemcached client connection. libmemcached tried to use the previous connection that had been closed with a FIN, which resulted in a TCP RST from the other end. This failure caused libmemcached to set a backoff timeout on the connection, so that even though the TCP FIN had arrived several minutes ago, the memcached server was running again and the reconnection attempt succeeded, libmemcached wouldn't let me make any more requests on that connection for a short while.

I also noticed that the behaviour varied depending on what type of request I was making - if I tried to store data in memcached, the error code was "MEMCACHED_CONNECTION_FAILED" (which was useful as I could simply notice that and retry the request) but when retrieving data from memcached the error code was "MEMCACHED_NOT_FOUND" which was much less useful.

The attached patch (against the v1.0 trunk, though I was using libmemcached 1.0.10 when I saw this behaviour) fixes both these issues:

  • for TCP connections, an failure to send data will never set a backoff timeout on the server - only a failure to connect will do that. This protects against the case where a remote server drops the connection, but this is not noticed for a short while, during which the server recovers. The request to send data will still fail, but if the request is retried, libmemcached will successfully re-establish the connection and send the data rather than rejecting the request due to backoff logic. (The behaviour for UDP is unchanged.)

  • for get/gets requests, if there is no MEMCACHED_SUCCESS result and one or more servers returned a MEMCACHED_CONNECTION_FAILED error, the return code will be MEMCACHED_CONNECTION_FAILED rather than MEMCACHED_NOT_FOUND. This lets the client make informed decisions about whether to retry.

I'm afraid my editor has stripped trailing spaces in a couple of places - hopefully that's not too confusing.

I have permission from my employer to contribute this back under libmemcached's 3-clause BSD license.

Paralle build ability lost in 1.0.18

Imported from Launchpad using lp2gh.


The problematic line is:

Makefile.in:10358:@[email protected]: $(dist_man_MANS)

It seems the intent was that $(dist_man_MANS) is not built in parallel. However, that is not how NOTPARALLEL works:

.NOTPARALLEL' If .NOTPARALLEL' is mentioned as a target, then this invocation of
make' will be run serially, even if the -j' option is given.
Any recursively invoked `make' command will still be run in
parallel (unless its makefile contains this target). Any
prerequisites on this target are ignored.

Note the last sentence. This line now prevents make from building in parallel. Commenting out the corresponding line in the generated Makefile restores parallel build ability.

SSL/TLS support

Imported from Launchpad using lp2gh.


Various client libraries use libmemcached, and they're blocked on supporting SSL. I don't think we can trust the datacenters anymore with our sensitive data. The recent scandals have taught us that. Our caching service provider through heroku is starting to turn on SSL, but our client (pylibmc) doesn't support SSL since it depends on libmemcached.

Cannot configure SASL support on OS X

Imported from Launchpad using lp2gh.


I'm trying to build libmemcached with SASL support on OS X Mountain Lion.

I have built memcached (1.4.15) with SASL support:

    $ memcached -S -vv
    Initialized SASL.
    slab class   1: chunk size        96 perslab   10922
    ...
    slab class  42: chunk size   1048576 perslab       1
    <17 server listening (binary)
    <18 server listening (binary)
    <19 send buffer was 9216, now 3728270
    <20 send buffer was 9216, now 3728270
    <19 server listening (udp)
    <20 server listening (udp)
    ...

I am trying to build libmemcached with SASL support too. I have tried the following:

    $ ./configure --prefix=/usr/local \
      --with-memcached-sasl=/usr/local/bin/memcached
    ...
    $ ./configure --prefix=/usr/local \
      --with-memcached-sasl="/usr/local/bin/memcached -S"
    ...

But the resulting configuration summary is the same for both:

Configuration summary for libmemcached version 1.0.11
       * Installation prefix:       /usr/local
       * System type:               apple-darwin12.2.0
       * Host CPU:                  x86_64
       * C Compiler:                i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
       * C Flags:                    -O2 -Werror -Wall -Wextra -std=c99 -Wbad-function-cast -Wmissing-prototypes -Wnested-externs -Woverride-init
       * C++ Compiler:              i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
       * C++ Flags:                  -O2 -Werror -Wall -Wextra -Wpragmas -D_FORTIFY_SOURCE=2 -Waddress -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wmissing-field-initializers -Wmissing-noreturn -Wnon-virtual-dtor -Wnormalized=id -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wunused-variable -Wwrite-strings -fwrapv -ggdb
       * CPP Flags:                 -I/usr/local/include
       * Assertions enabled:        no
       * Debug enabled:             no
       * Warnings as failure:       no
       * SASL support:              

Am I doing something incorrectly? Thanks.

XPASS: : clients/memaslap

Imported from Launchpad using lp2gh.


When building with --enable-memaslap and running "make test"

Output:

XFAIL: clients/memstat
No Servers provided

memslap v1.0
    Generates workload against memcached servers.

Usage:
    memslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]

Options:
    -s, --servers=
        List one or more servers to connect. Servers count must be less than
        threads count. e.g.: --servers=localhost:1234,localhost:11211
    -T, --threads=
        Number of threads to startup, better equal to CPU numbers. Default 8.
    -c, --concurrency=
        Number of concurrency to simulate with load. Default 128.
    -n, --conn_sock=
        Number of TCP socks per concurrency. Default 1.
    -x, --execute_number=
        Number of operations(get and set) to execute for the
        given test. Default 1000000.
    -t, --time=
        How long the test to run, suffix: s-seconds, m-minutes, h-hours,
        d-days e.g.: --time=2h.
    -F, --cfg_cmd=
        Load the configure file to get command,key and value distribution list.
    -w, --win_size=
        Task window size of each concurrency, suffix: K, M e.g.: --win_size=10k.
        Default 10k.
    -X, --fixed_size=
        Fixed length of value.
    -v, --verify=
        The proportion of date verification, e.g.: --verify=0.01
    -d, --division=
        Number of keys to multi-get once. Default 1, means single get.
    -S, --stat_freq=
        Frequency of dumping statistic information. suffix: s-seconds,
        m-minutes, e.g.: --resp_freq=10s.
    -e, --exp_verify=
        The proportion of objects with expire time, e.g.: --exp_verify=0.01.
        Default no object with expire time
    -o, --overwrite=
        The proportion of objects need overwrite, e.g.: --overwrite=0.01.
        Default never overwrite object.
    -R, --reconnect 
        Reconnect support, when connection is closed it will be reconnected.
    -U, --udp 
        UDP support, default memslap uses TCP, TCP port and UDP port of
        server must be same.
    -a, --facebook 
        Whether it enables facebook test feature, set with TCP and multi-get with UDP.
    -B, --binary 
        Whether it enables binary protocol. Default with ASCII protocol.
    -P, --tps=
        Expected throughput, suffix: K, e.g.: --tps=10k.
    -p, --rep_write=
        The first nth servers can write data, e.g.: --rep_write=2.
    -b, --verbose 
        Whether it outputs detailed information when verification fails.
    -h, --help 
        Display this message and then exit.
    -V, --version 
        Display the version of the application and then exit.

Examples:
    memslap -s 127.0.0.1:11211 -S 5s
    memslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b
    memslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2
    memslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k
    memslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40
    memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m
    memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2

XPASS: clients/memaslap

1 of 21 tests did not behave as expected (1 unexpected pass)
(19 tests were not run)
Please report to http://libmemcached.org/

make fails with: libmemcached/.libs/libmemcached.so: undefined reference to `pthread_once'

Imported from Launchpad using lp2gh.


On Ubuntu 13.10.

Steps to reproduce:

tar zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make

Output:
...
CXXLD libmemcachedinternal/libmemcachedinternal.la
copying selected object files to avoid basename conflicts...
CXX libmemcached/libmemcachedinternal_libmemcachedutilinternal_la-backtrace.lo
CXX libmemcachedutil/libmemcachedinternal_libmemcachedutilinternal_la-flush.lo
CXX libmemcachedutil/libmemcachedinternal_libmemcachedutilinternal_la-pid.lo
CXX libmemcachedutil/libmemcachedinternal_libmemcachedutilinternal_la-ping.lo
CXX libmemcachedutil/libmemcachedinternal_libmemcachedutilinternal_la-pool.lo
CXX libmemcachedutil/libmemcachedinternal_libmemcachedutilinternal_la-version.lo
CXXLD libmemcachedinternal/libmemcachedutilinternal.la
CXX clients/clients_memcapable-memcapable.o
CXX libmemcached/clients_memcapable-byteorder.o
CXXLD clients/memcapable
CXX clients/memcat.o
CXXLD clients/memcat
CXX clients/memcp.o
CXXLD clients/memcp
CXX clients/memdump.o
CXXLD clients/memdump
CXX clients/memerror.o
CXXLD clients/memerror
CXX clients/memexist.o
CXXLD clients/memexist
CXX clients/memtouch.o
CXXLD clients/memtouch
CXX clients/memflush.o
CXXLD clients/memflush
CXX clients/memparse.o
CXXLD clients/memparse
libmemcached/.libs/libmemcached.so: undefined reference to pthread_once' collect2: error: ld returned 1 exit status make[1]: *** [clients/memparse] Error 1 make[1]: Leaving directory /mnt/scratch/Downloads/libmemcached-1.0.18'
make: *** [all] Error 2

libmemcached-1.0.17 fails tests

Imported from Launchpad using lp2gh.


=========================================
3 of 39 tests failed
(2 tests were not run)
Please report to http://libmemcached.org/

FAIL: tests/memslap
FAIL: tests/testhashkit
FAIL: tests/libmemcached-1.0/testapp

The build and logs are available here.
http://dev.gentoo.org/~prometheanfire/bugs/430126/libmemcached-1.0.17.tar.gz
you should look in the temp folder for the build log

Incorrect fallthrough in memcached_behavior_set for REMOVE_FAILED_SERVERS

Imported from Launchpad using lp2gh.


memcached_behavior_set contains the following two cases, the first falls through into the second:

  case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
    ptr->flags.auto_eject_hosts= bool(data);

  case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
    if (data == 0)
    {
      return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT,
                                        memcached_literal_param("MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT requires a value greater then zero."));
    }
    ptr->server_failure_limit= uint32_t(data);
    break;

Having zero data for the first is perfectly valid (it means "don't remove failed servers,"), when when we fall through, it causes an error. There should be a "break" at the end of that first case block.

libclang_rt.ubsan_osx.a clang: error: linker command failed

Imported from Launchpad using lp2gh.


  • C Flags: -g -O2 -Wno-unknown-pragmas -Qunused-arguments -Wall -Wextra -std=c99 -Wno-attributes -Waddress -Wvarargs -Warray-bounds -Wbad-function-cast -Wchar-subscripts -Wcomment -Wfloat-equal -Wformat-security -Wformat=2 -Wformat-y2k -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wpointer-sign -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wstrict-prototypes -Wswitch-enum -Wundef -fsanitize=alignment -fsanitize=bool -fsanitize=bounds -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=object-size -fsanitize=return -fsanitize=shift -fsanitize=signed-integer-overflow -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=vptr -Wunused -Wunused-result -Wunused-variable -Wunused-parameter -Wwrite-strings -fwrapv -pipe
  • C++ Compiler: Apple LLVM version 5.1 (clang-503.0.19) (based on LLVM 3.4svn)
  • C++ Flags: -g -O2 -Wno-unknown-pragmas -Qunused-arguments -Wall -Wextra -Wno-attributes -Wvarargs -Waddress -Warray-bounds -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wformat-y2k -Wmissing-field-initializers -Wnon-virtual-dtor -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wc++11-compat -fsanitize=alignment -fsanitize=bool -fsanitize=bounds -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=object-size -fsanitize=return -fsanitize=shift -fsanitize=signed-integer-overflow -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=vptr -Wunused -Wunused-result -Wunused-variable -Wunused-parameter -Wwrite-strings -Wformat-security -fwrapv -pipe
  • CPP Flags: -fvisibility=hidden
  • LIB Flags:
  • Assertions enabled: no
  • Debug enabled: no
  • Shared: yes
  • Warnings as failure: no
  • SASL support: yes
  • make -j: 5
  • VCS checkout: no

==> make install
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j5 install-am
make[1]: warning: -jN forced in submake: disabling jobserver mode.
CXX libhashkit/libmemcached_libmemcached_la-aes.lo
CXX libhashkit/libmemcached_libmemcached_la-algorithm.lo
CXX libhashkit/libmemcached_libmemcached_la-behavior.lo
CXX libhashkit/libmemcached_libmemcached_la-crc32.lo
CXX libhashkit/libmemcached_libmemcached_la-digest.lo
CXX libha
ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.ubsan_osx.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libtest/abort] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [install] Error 2

Scary -floop-parallelize-all option doesn't actually do anything except annoy package developers

Imported from Launchpad using lp2gh.


One might think, reading the description of -floop-parallelize-all in the gcc manual, that -floop-parallelize-all will cause automatic parallelization of all loops by enabling a rarely-used, alpha-quality automatic parallelization feature called Graphite. However, this scary prospect is averted because -floop-parallelize-all doesn't actually generate parallel code unless you also specify -ftree-parallelize-loops=N where N is the thread count (that's right, it's fixed at compile time). This is explained at http://gcc.gnu.org/wiki/Graphite/Parallelization

So all -floop-parallelize-all does is cause the build to fail if libcloog is missing (i.e. bug #1232551), and increase compile time somewhat. I suggest that it be removed.

Compiling with -flto

Imported from Launchpad using lp2gh.


I have gcc490, libtool 2.4.2.444.30-da30-dirty, and libmemcached 1.0.18. I run CFLAGS = "-flto -O3" CXXCFLAGS="-flto -O3" ./configure . In turn, because of optimizations, client/.libs/libutilities.a does not contain close_stdio and clients/memcapable does not link due to missing close_stdio() .

Please disable -fvisibility=hidden from CPPflags, when creating clients/libutilities , so that close_stdio() is contained there /remains visible when linking to the programs in clients/, or ensure by other means, that passing -flto to GCC can link the clients/ programs.

Compiling with just -O3 and without -flto works fine.

Libmemcached 1.0.16 SET does not replicate

Imported from Launchpad using lp2gh.


Hi,
I am currently trying to test libmemcached but I am facing a strange behaviour:

Let's say we have two memcached servers (A and B) and a data d.
I want to put this data on the servers so that it will be available.
The key hash seem to designate the node A as the primary and B as the replicate.
If B is down, the data is written only on A.
But if A is not up, d is not automatically written to B and is lost.

Is this what was intended?
I saw some lines on storage.cc that let me suppose that if the first node does not succeed in saving the data, then it is not saved at all.

I'm using libmemcached 1.0.16 with binary protocol, CAS support and number of replicas to 1

Regards,
cube45

Build failure in libtest/cmdline.cc:790, gcc 4.3.3

Imported from Launchpad using lp2gh.


Hello,

Libmemcached version: 1.0.18
Env: x86_64, slackware 13.0, GCC 4.3.3, config.log attached

I've stumbled onto this build failure, here is the output:

# ./configure --without-memcached && make
...
  CXX      libtest/libtest_libtest_la-cmdline.lo
/usr/lib64/gcc/x86_64-slackware-linux/4.3.3/../../../../include/c++/4.3.3/ext/new_allocator.h: In member function 'void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, _Args&& ...) [with _Args = long int, _Tp = char*]':
/usr/lib64/gcc/x86_64-slackware-linux/4.3.3/../../../../include/c++/4.3.3/bits/stl_vector.h:703:   instantiated from 'void std::vector<_Tp, _Alloc>::push_back(_Args&& ...) [with _Args = long int, _Tp = char*, _Alloc = std::allocator<char*>]'
libtest/cmdline.cc:790:   instantiated from here
/usr/lib64/gcc/x86_64-slackware-linux/4.3.3/../../../../include/c++/4.3.3/ext/new_allocator.h:114: error: invalid conversion from 'long int' to 'char*'
make[1]: *** [libtest/libtest_libtest_la-cmdline.lo] Error 1
make[1]: Leaving directory `/var/src/libs/libmemcached-1.0.18'
make: *** [all] Error 2

The line in question is this, in libtest/cmdline.cc

void Application::create_argv(const char *args[])
{
  ...
  built_argv.push_back(NULL);
}

Can anyone give a quick hint how to overcome this?

Thank you,
b.

connection over ipv6 is broken

Imported from Launchpad using lp2gh.


How to reproduce:
connect to any server over ipv6. On setting value it wil return erro "getaddrinfo() or getnameinfo() HOSTNAME LOOKUP FAILURE"

This happens because of connect.cc, function set_hostinfo
There is string
hints.ai_family= AF_INET;
It restricts host lookups to ipv4 only.
It was uncommented in revision 1144
http://bazaar.launchpad.net/~tangent-trunk/libmemcached/1.0/revision/1144#libmemcached/connect.cc

And it should be removed, so noone would uncomment it!

memcached_increment_with_initial() sets wrong initial value

Imported from Launchpad using lp2gh.


When calling memcached_increment_with_initial(memcached_st*, length, 1, 1, timeout, &out) (if there is no such key in memcached) you would expect this key to have "1" value. But it has something really weird:

"1\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"

So the key value is a 22 characters string with a number at the beginning and then padding zeros. You can see it when yo use telnet and ask memcached directly for key value:

get get ADV-CNTR-IMP-not-a-date-time-3--1:-1
VALUE ADV-CNTR-IMP-not-a-date-time-3--1:-1 0 22
1END

Also Python library reports the same value.

From C language perspective this bug is not visible and this is probably why it hasn't been found yet. Any subsequent call to memcached_increment_with_initial sets value to a correct format, for example "2".

memcached::Memcached C++ wrapper doesn't give error codes

Imported from Launchpad using lp2gh.


The class memcached::Memcached seemed to be great as I am a C++ developer. However, the return types of methods like get or mget are annoying:
Sometimes (for a MEMCACHED_NOTFOUND or a MEMCACHED_DATA_EXISTS for example), the function returns false, but when I get the error codes, it returns MEMCACHED_SUCCESS!

example code:

	std::string key = "key";
	std::vector<char> readData;
	if(!m_memcached->get(key, readData))
	{
		memcached_return_t result = MEMCACHED_SUCCESS;
		m_memcached->error(result);//result can be MEMCACHED_SUCCESS here!
	}

error after resetting servers and trying to add new ones

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

Building as of 1.0.18 fails due to missing aclocal

Imported from Launchpad using lp2gh.


Previously, a Perl module that I maintain (Memcached::libmemcached) that wraps libmemcached was able to build on Travis-CI:

https://travis-ci.org/timbunce/Memcached-libmemcached/jobs/20770244

It would complain about missing aclocal files, but continue on anyway:

cd src/libmemcached && make install
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/travis/build/timbunce/Memcached-libmemcached/src/libmemcached/build-aux/missing --run aclocal-1.12 -I m4 -I libtest/m4
/home/travis/build/timbunce/Memcached-libmemcached/src/libmemcached/build-aux/missing: line 51: aclocal-1.12: command not found
WARNING: 'aclocal-1.12' is missing on your system. You should only need it if
you modified 'acinclude.m4' or 'configure.ac'. You might want
to install the Automake and Perl packages. Grab them from
any GNU archive site.

With 1.0.18 though, it fails:

https://travis-ci.org/timbunce/Memcached-libmemcached/jobs/22484346

With this output:

cd src/libmemcached && make install
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/travis/build/timbunce/Memcached-libmemcached/src/libmemcached/build-aux/missing aclocal-1.13 -I m4 -I libtest/m4
/home/travis/build/timbunce/Memcached-libmemcached/src/libmemcached/build-aux/missing: line 81: aclocal-1.13: command not found
WARNING: 'aclocal-1.13' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
http://www.gnu.org/software/automake
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
http://www.gnu.org/software/autoconf
http://www.gnu.org/software/m4/
http://www.perl.org/
make: *** [aclocal.m4] Error 127
Unable to build libmemcached: Error running cd src/libmemcached && make install

It looks like libmemcached/build-aux/missing would previously throw the above warning, attempt to behave like aclocal, and then exit 0.

Now, it seems to exit 127, and cause the build to fail.

For the most part, this succeeds building on my local computer (though I saw it fail once like above but I haven't been able to repeat it since.)

Why did this behaviour change? Is this a bug?

Thanks,

-- Matthew Horsfall (alh)

libmemcached-1.0.15 build fails on RHEL5 with gcc-4.7.2

Imported from Launchpad using lp2gh.


I'm trying to build libmemcached-1.0.15 on RHEL5 and RHEL6 (via mock installed on RHEL6 machine). Details of actual mock environments are in attachment RHELX_root.log. I'm using custom-built gcc-4.7.2.
note1: every custom-build package has 'adl-' prefix
note2: by 'custom-built I mean just getting sources of gcc-4.7.2.tar.bz2, gmp-5.1.0.tar.bz2, mpc-1.0.1.tar.gz and mpfr-3.1.1.tar.bz2 and compiling them on the right platform (RHEL5 and RHEL6). The only difference in in install path, which is in /opt/shared/. Of course, environment variables has to be set and correct -I flags provided, which I had done.

Build is set-up in Fedora-like style (sources->srpm->compilation->rpm)

In RHEL6 environment, the build passes flawlessly.
In RHEL5 environment, the build fails with following errors:
#############################################################
CXXLD clients/libutilities.la
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-binary_handler.o: In function recv': /usr/include/bits/socket2.h:35: multiple definition of recv'
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-ascii_handler.o:/usr/include/bits/socket2.h:35: first defined here
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-binary_handler.o: In function recvfrom': /usr/include/bits/socket2.h:55: multiple definition of recvfrom'
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-ascii_handler.o:/usr/include/bits/socket2.h:55: first defined here
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-binary_handler.o: In function stpncpy': /usr/include/bits/string3.h:160: multiple definition of stpncpy'
libmemcachedprotocol/.libs/libmemcached_libmemcachedprotocol_la-ascii_handler.o:/usr/include/bits/string3.h:160: first defined here
...
... full error build log in attachment "RHEL5_build.log" (compiled with -v -Wl,-trace flags)
##############################################################
This error suggests, the are some symbols in .o files, that should not be there - and really: I believe all those .hidden except memcached_ascii_protocol_process_data are not supposed to be there:
##############################################################
[jevickyj@voda .libs]$ objdump -t libmemcached_libmemcachedprotocol_la-ascii_handler.o

libmemcached_libmemcachedprotocol_la-ascii_handler.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l df ABS 0000000000000000 ascii_handler.c
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 l d .bss 0000000000000000 .bss
0000000000000000 l F .text 00000000000000a9 parse_ascii_key
0000000000000000 l d .rodata.str1.1 0000000000000000 .rodata.str1.1
00000000000000b0 l F .text 00000000000001d7 ascii_get_response_handler
0000000000000000 l d .rodata.str1.8 0000000000000000 .rodata.str1.8
0000000000000290 l F .text 00000000000000a4 raw_response_handler
0000000000000340 l F .text 00000000000000ae ascii_stat_response_handler
00000000000003f0 l F .text 000000000000005c ascii_version_response_handler
0000000000000450 l F .text 0000000000000033 send_command_usage
0000000000000000 l d .rodata 0000000000000000 .rodata
0000000000000000 l d .debug_frame 0000000000000000 .debug_frame
0000000000000000 l d .eh_frame 0000000000000000 .eh_frame
0000000000000000 l d .debug_info 0000000000000000 .debug_info
0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev
0000000000000000 l d .debug_loc 0000000000000000 .debug_loc
0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges
0000000000000000 l d .debug_ranges 0000000000000000 .debug_ranges
0000000000000000 l d .debug_line 0000000000000000 .debug_line
0000000000000000 l d .debug_str 0000000000000000 .debug_str
0000000000000000 l d .note.GNU-stack 0000000000000000 .note.GNU-stack
000000000000000d l .rodata.str1.1 0000000000000000 .LC36
0000000000000016 l .rodata.str1.1 0000000000000000 .LC37
0000000000000000 l .rodata.str1.1 0000000000000000 .LC35
0000000000000000 l .rodata.str1.8 0000000000000000 .LC38
0000000000000019 l .rodata.str1.1 0000000000000000 .LC39
0000000000000023 l .rodata.str1.1 0000000000000000 .LC40
0000000000000029 l .rodata.str1.1 0000000000000000 .LC41
000000000000002b l .rodata.str1.1 0000000000000000 .LC42
0000000000000031 l .rodata.str1.1 0000000000000000 .LC43
00000000000001b9 l .rodata.str1.1 0000000000000000 .LC75
000000000000014e l .rodata.str1.1 0000000000000000 .LC63
0000000000000440 l .rodata.str1.8 0000000000000000 .LC46
00000000000001b4 l .rodata.str1.1 0000000000000000 .LC73
0000000000000498 l .rodata.str1.8 0000000000000000 .LC71
00000000000001ae l .rodata.str1.1 0000000000000000 .LC72
00000000000004c0 l .rodata.str1.8 0000000000000000 .LC74
00000000000000d1 l .rodata.str1.1 0000000000000000 .LC56
00000000000000e2 l .rodata.str1.1 0000000000000000 .LC57
00000000000000f7 l .rodata.str1.1 0000000000000000 .LC58
000000000000010a l .rodata.str1.1 0000000000000000 .LC59
000000000000011a l .rodata.str1.1 0000000000000000 .LC60
000000000000012f l .rodata.str1.1 0000000000000000 .LC61
000000000000013e l .rodata.str1.1 0000000000000000 .LC62
000000000000003a l .rodata.str1.1 0000000000000000 .LC47
0000000000000049 l .rodata.str1.1 0000000000000000 .LC48
0000000000000058 l .rodata.str1.1 0000000000000000 .LC49
000000000000006b l .rodata.str1.1 0000000000000000 .LC50
000000000000007a l .rodata.str1.1 0000000000000000 .LC51
000000000000008c l .rodata.str1.1 0000000000000000 .LC52
000000000000009f l .rodata.str1.1 0000000000000000 .LC53
00000000000000b1 l .rodata.str1.1 0000000000000000 .LC54
00000000000000c1 l .rodata.str1.1 0000000000000000 .LC55
0000000000000468 l .rodata.str1.8 0000000000000000 .LC64
000000000000018b l .rodata.str1.1 0000000000000000 .LC68
00000000000001a4 l .rodata.str1.1 0000000000000000 .LC70
0000000000000161 l .rodata.str1.1 0000000000000000 .LC65
0000000000000197 l .rodata.str1.1 0000000000000000 .LC69
0000000000000179 l .rodata.str1.1 0000000000000000 .LC66
0000000000000182 l .rodata.str1.1 0000000000000000 .LC67
0000000000000000 l d .comment 0000000000000000 .comment
0000000000000000 UND 0000000000000000 GLOBAL_OFFSET_TABLE
0000000000000000 UND 0000000000000000 __ctype_b_loc
0000000000000000 UND 0000000000000000 __snprintf_chk
0000000000000000 UND 0000000000000000 __stack_chk_fail
0000000000000000 UND 0000000000000000 stderr
0000000000000000 UND 0000000000000000 __fprintf_chk
0000000000000000 UND 0000000000000000 strlen
0000000000000490 g F .text 0000000000000005 .hidden recv
00000000000004a0 g F .text 0000000000000005 .hidden recvfrom
00000000000004b0 g F .text 0000000000000005 .hidden stpncpy
00000000000004c0 g F .text 000000000000001c .hidden __pthread_cleanup_routine
00000000000004e0 g F .text 0000000000000005 .hidden read
00000000000004f0 g F .text 0000000000000005 .hidden pread
0000000000000500 g F .text 0000000000000005 .hidden pread64
0000000000000510 g F .text 0000000000000005 .hidden readlink
0000000000000520 g F .text 0000000000000005 .hidden readlinkat
0000000000000530 g F .text 0000000000000005 .hidden getcwd
0000000000000540 g F .text 0000000000000005 .hidden getwd
0000000000000550 g F .text 0000000000000005 .hidden confstr
0000000000000560 g F .text 0000000000000005 .hidden getgroups
0000000000000570 g F .text 0000000000000005 .hidden ttyname_r
0000000000000580 g F .text 0000000000000005 .hidden getlogin_r
0000000000000590 g F .text 0000000000000005 .hidden gethostname
00000000000005a0 g F .text 0000000000000005 .hidden getdomainname
00000000000005b0 g F .text 0000000000000005 .hidden gets
00000000000005c0 g F .text 0000000000000005 .hidden fgets
00000000000005d0 g F .text 0000000000000005 .hidden fgets_unlocked
00000000000005e0 g F .text 0000000000000005 .hidden realpath
00000000000005f0 g F .text 0000000000000005 .hidden ptsname_r
0000000000000600 g F .text 0000000000000005 .hidden wctomb
0000000000000610 g F .text 0000000000000005 .hidden mbstowcs
0000000000000620 g F .text 0000000000000005 .hidden wcstombs
0000000000000630 g F .text 00000000000010b6 .hidden memcached_ascii_protocol_process_data
0000000000000000 UND 0000000000000000 memchr
0000000000000000 UND 0000000000000000 strncmp
0000000000000000 UND 0000000000000000 abort
0000000000000000 UND 0000000000000000 strtoul
0000000000000000 UND 0000000000000000 strtoull
###################################################################
Just for comparation - the same on RHEL6:
###################################################################
[jevickyj@voda .libs]$ objdump -t libmemcached_libmemcachedprotocol_la-ascii_handler.o

libmemcached_libmemcachedprotocol_la-ascii_handler.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l df ABS 0000000000000000 ascii_handler.c
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 l d .bss 0000000000000000 .bss
0000000000000000 l F .text 00000000000000a9 parse_ascii_key
0000000000000000 l d .rodata.str1.1 0000000000000000 .rodata.str1.1
00000000000000b0 l F .text 00000000000001c7 ascii_get_response_handler
0000000000000000 l d .rodata.str1.8 0000000000000000 .rodata.str1.8
0000000000000280 l F .text 00000000000000a4 raw_response_handler
0000000000000330 l F .text 00000000000000ae ascii_stat_response_handler
00000000000003e0 l F .text 000000000000005c ascii_version_response_handler
0000000000000440 l F .text 0000000000000033 send_command_usage
0000000000000000 l d .rodata 0000000000000000 .rodata
0000000000000000 l d .debug_info 0000000000000000 .debug_info
0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev
0000000000000000 l d .debug_loc 0000000000000000 .debug_loc
0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges
0000000000000000 l d .debug_ranges 0000000000000000 .debug_ranges
0000000000000000 l d .debug_line 0000000000000000 .debug_line
0000000000000000 l d .debug_str 0000000000000000 .debug_str
0000000000000000 l d .note.GNU-stack 0000000000000000 .note.GNU-stack
0000000000000000 l d .eh_frame 0000000000000000 .eh_frame
000000000000000d l .rodata.str1.1 0000000000000000 .LC36
0000000000000016 l .rodata.str1.1 0000000000000000 .LC37
0000000000000000 l .rodata.str1.1 0000000000000000 .LC35
0000000000000000 l .rodata.str1.8 0000000000000000 .LC38
0000000000000019 l .rodata.str1.1 0000000000000000 .LC39
0000000000000023 l .rodata.str1.1 0000000000000000 .LC40
0000000000000029 l .rodata.str1.1 0000000000000000 .LC41
000000000000002b l .rodata.str1.1 0000000000000000 .LC42
0000000000000031 l .rodata.str1.1 0000000000000000 .LC43
00000000000001b9 l .rodata.str1.1 0000000000000000 .LC75
000000000000014e l .rodata.str1.1 0000000000000000 .LC63
0000000000000440 l .rodata.str1.8 0000000000000000 .LC46
00000000000001b4 l .rodata.str1.1 0000000000000000 .LC73
0000000000000498 l .rodata.str1.8 0000000000000000 .LC71
00000000000001ae l .rodata.str1.1 0000000000000000 .LC72
00000000000004c0 l .rodata.str1.8 0000000000000000 .LC74
00000000000000d1 l .rodata.str1.1 0000000000000000 .LC56
00000000000000e2 l .rodata.str1.1 0000000000000000 .LC57
00000000000000f7 l .rodata.str1.1 0000000000000000 .LC58
000000000000010a l .rodata.str1.1 0000000000000000 .LC59
000000000000011a l .rodata.str1.1 0000000000000000 .LC60
000000000000012f l .rodata.str1.1 0000000000000000 .LC61
000000000000013e l .rodata.str1.1 0000000000000000 .LC62
000000000000003a l .rodata.str1.1 0000000000000000 .LC47
0000000000000049 l .rodata.str1.1 0000000000000000 .LC48
0000000000000058 l .rodata.str1.1 0000000000000000 .LC49
000000000000006b l .rodata.str1.1 0000000000000000 .LC50
000000000000007a l .rodata.str1.1 0000000000000000 .LC51
000000000000008c l .rodata.str1.1 0000000000000000 .LC52
000000000000009f l .rodata.str1.1 0000000000000000 .LC53
00000000000000b1 l .rodata.str1.1 0000000000000000 .LC54
00000000000000c1 l .rodata.str1.1 0000000000000000 .LC55
0000000000000468 l .rodata.str1.8 0000000000000000 .LC64
000000000000018b l .rodata.str1.1 0000000000000000 .LC68
00000000000001a4 l .rodata.str1.1 0000000000000000 .LC70
0000000000000161 l .rodata.str1.1 0000000000000000 .LC65
0000000000000197 l .rodata.str1.1 0000000000000000 .LC69
0000000000000179 l .rodata.str1.1 0000000000000000 .LC66
0000000000000182 l .rodata.str1.1 0000000000000000 .LC67
0000000000000000 l d .comment 0000000000000000 .comment
0000000000000000 UND 0000000000000000 GLOBAL_OFFSET_TABLE
0000000000000000 UND 0000000000000000 __ctype_b_loc
0000000000000000 UND 0000000000000000 __snprintf_chk
0000000000000000 UND 0000000000000000 __stack_chk_fail
0000000000000000 UND 0000000000000000 stderr
0000000000000000 UND 0000000000000000 __fprintf_chk
0000000000000000 UND 0000000000000000 strlen
0000000000000480 g F .text 000000000000112b .hidden memcached_ascii_protocol_process_data
0000000000000000 UND 0000000000000000 memchr
0000000000000000 UND 0000000000000000 strncmp
0000000000000000 UND 0000000000000000 abort
0000000000000000 UND 0000000000000000 strtoul
0000000000000000 UND 0000000000000000 strtoull
##############################################################
I would really appreciate a help with finding a root cause and/or fix.

Last but not least: I've also notticed on RHEL6, that while the library itself is compiled by my selected compiler (gcc/g++ from adl-gcc package, version 4.7.2), the unit test suite was compiled by default RHEL6 gcc 4.4.6 - is there any $PATH re-setting before unit-test compilation or any other reason, why first half is built by one compiler and the second half by another? And if there is, is that correct? (See "RHEL6_build.log" attachment for details).

Best Regards,

Jiri Jevicky

Wrong size check in memcached_last_error_message

Imported from Launchpad using lp2gh.


memcached_last_error_message contains the following:

  if (memc->error_messages->size == 0)
  {
    return memc->error_messages->message;
  }

  return memcached_strerror(memc, memc->error_messages->rc);

The check against "size" should be "size > 0", a size of zero means the string is empty.

Fails to build on GNU/Hurd

Imported from Launchpad using lp2gh.


libmemcached 1.0.17 does not compile on GNU/Hurd. Also, there is one failure when running the test suite.

The attached patch fixes the following issues:

  • libtest/timer.cc
    The code in the MACH blocks is specific to Mac OS X; since GNU/Hurd runs on a Mach-based microkernel (gnumach), MACH is defined by the compiler, leading to compile issues. The solution is just changing the checked symbol (APPLE) so it is really used only on Mac OS X.

  • libtest/unittest.cc
    The Hurd implementation of posix_spawn in glibc fails straight away when the filename does not exist, i.e. what happens in application_doesnotexist_BINARY. Thus, fix the expected return value to be INVALID_POSIX_SPAWN.

libmemcached does not compile on Mac OS X Mavericks

Imported from Launchpad using lp2gh.


I'm trying to compile libmemcached and it doesn't go beyond one specific point. I am no C expert so I really don't know where to go further. I've tried to manually adjust some values in the Makefile but I did just mess it up more.

./configure works fine, problem comes with make (output from make --debug):

Must remake target tests/memerror'. CXXLD tests/memcat File tests/memslap' does not exist.
Must remake target tests/memslap'. CXXLD tests/memerror File tests/memdump' does not exist.
Must remake target tests/memdump'. CXXLD tests/memslap CXXLD tests/memdump File all-am' does not exist.
File tests/libmemcached-1.0/internals' does not exist. File all-am' does not exist.
File tests/libmemcached-1.0/internals' does not exist. File all-am' does not exist.
File tests/libmemcached-1.0/internals' does not exist. File all-am' does not exist.
File `tests/libmemcached-1.0/internals' does not exist.
^Cmake[1]: *** [libmemcachedinternal/libmemcachedutilinternal.la] Interrupt: 2
make: *** [all] Interrupt: 2

At the point of the last:
File all-am' does not exist. File tests/libmemcached-1.0/internals' does not exist.

It just waits and nothing happens. I've waited for over an hour and still nothing. I've downgraded all the way back to 1.0.14 and still the same error.

Maybe it is an version problem error?

Configure command gives the following information at the end, if you need any more information, please do ask for it.


Configuration summary for libmemcached version 1.0.14

  • Installation prefix: /usr/local
  • System type: apple-darwin13.0.0
  • Host CPU: x86_64
  • C Compiler: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
  • C Flags: -g -O2 -Wno-pragmas -Wall -Wextra -Wunknown-pragmas -std=c99 --param=ssp-buffer-size=1 -Wno-attributes -Waddress -Wbad-function-cast -Wchar-subscripts -Wcomment -Wfloat-equal -Wformat-security -Wformat=2 -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wnormalized=id -Woverride-init -Wpointer-arith -Wpointer-sign -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wunused -Wunused-variable -Wwrite-strings -fwrapv -pipe
  • C++ Compiler: i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
  • C++ Flags: -g -O2 -Wno-pragmas -Wall -Wextra -Wunknown-pragmas --param=ssp-buffer-size=1 -Wno-attributes -Waddress -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wmissing-field-initializers -Wnon-virtual-dtor -Wnormalized=id -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wunused -Wunused-variable -Wwrite-strings -Wformat-security -fwrapv
  • CPP Flags: -fvisibility=hidden
  • LIB Flags: -z -pie
  • Assertions enabled: no
  • Debug enabled: no
  • Warnings as failure: no
  • SASL support: yes
  • make -j: 5
  • VCS checkout: no

Greetings.

Assertion `memcached_failed(rc)' failed in memcached_send_ascii

Imported from Launchpad using lp2gh.


I can reproduce that on ubuntu 14.04 with php-5.5.9-1ubuntu4.2, php-memcached-2.1.0 and libmemached-1.0.8:

php: libmemcached/storage.cc:341: memcached_return_t memcached_send_ascii(memcached_st*, memcached_server_write_instance_st, const char*, size_t, const char*, size_t, time_t, uint32_t, uint64_t, bool, bool, memcached_storage_action_t): Assertion `memcached_failed(rc)' failed.

Also on gentoo with php-5.5.14, php-memcached-2.1.0 (and 2.2.0 too) and libmemached-1.0.18:

php: libmemcached/storage.cc:343: memcached_return_t memcached_send_ascii(Memcached*, memcached_instance_st*, const char*, size_t, const char*, size_t, time_t, uint32_t, uint64_t, bool, bool, memcached_storage_action_t): Assertion `memcached_failed(rc)' failed.

But I can't reproduce that on mac with php-5.5.14, php-memcached-2.1.0 and libmemcached-1.0.18. That's weird.

Good part is: I have a test-case:

mctest.php:

<?php

$M = new Memcached();
$M->addServers(array(array(
    'host' => '127.0.0.1',
    'port' => 12344,
)));

$f = fopen('mc.log.short', 'r');
$i = 0;
while ($line = fgets($f)) {
    $i++;

    echo $i.': '.$line;

    $line = json_decode($line);
    list($cmd, $args) = $line;

    if ($cmd == 'get') {
        unset($args[2]); // unset cas which is passed by reference
    }

    if ($cmd == 'cas') {
        $args = array_slice($args, 0, 4); // extra arg is some legacy
    }

    call_user_func_array(array($M, $cmd), $args);
}

And mc.log.short:

["add",["TestlockTestlib:type_Memcaches.id_default",true,600]]
["add",["Lock:upl_21",1358150402000000,86400]]
["get",["Lock:upl_21",null,null]]
["getResultCode",[]]
["cas",[2298,"Lock:upl_21",-1,1358150395]]
["add",["Lock:upl_21",1358150402000000,86400]]
["get",["Lock:upl_21",null,null]]
["getResultCode",[]]
["cas",[2300,"Lock:upl_21",-1,1358150395]]
["add",["Lock:upl_21",1358150402000000,86400]]
["get",["Lock:upl_21",null,null]]
["getResultCode",[]]
["cas",[2302,"Lock:upl_21",-1,1358150395]]
["get",["UserAppFriends_21",null,null]]
["add",["Lock:upl_22",1358150402000000,86400]]
["get",["Lock:upl_22",null,null]]
["getResultCode",[]]
["cas",[2304,"Lock:upl_22",-1,1358150395]]
["add",["Lock:upl_22",1358150402000000,86400]]
["get",["Lock:upl_22",null,null]]
["getResultCode",[]]
["cas",[2306,"Lock:upl_22",-1,1358150395]]
["add",["Lock:upl_23",1358150402000000,86400]]
["get",["Lock:upl_23",null,null]]
["getResultCode",[]]
["cas",[2308,"Lock:upl_23",-1,1358150395]]
["add",["Lock:upl_23",1358150402000000,86400]]
["get",["Lock:upl_23",null,null]]
["getResultCode",[]]
["cas",[2310,"Lock:upl_23",-1,1358150395]]
["add",["Lock:upl_24",1358150402000000,86400]]
["get",["Lock:upl_24",null,null]]
["getResultCode",[]]
["cas",[2312,"Lock:upl_24",-1,1358150395]]
["add",["Lock:upl_24",1358150402000000,86400]]
["get",["Lock:upl_24",null,null]]
["getResultCode",[]]
["cas",[2314,"Lock:upl_24",-1,1358150395]]
["add",["Lock:upl_25",1358150402000000,86400]]
["get",["Lock:upl_25",null,null]]
["getResultCode",[]]
["cas",[2316,"Lock:upl_25",-1,1358150395]]
["add",["Lock:upl_25",1358150402000000,86400]]
["get",["Lock:upl_25",null,null]]
["getResultCode",[]]
["cas",[2318,"Lock:upl_25",-1,1358150395]]
["add",["Lock:upl_25",1358150402000000,86400]]
["get",["Lock:upl_25",null,null]]
["getResultCode",[]]
["cas",[2320,"Lock:upl_25",-1,1358150395]]
["get",["UserAppFriends_25",null,null]]
["add",["Lock:upl_26",1358150402000000,86400]]
["get",["Lock:upl_26",null,null]]
["getResultCode",[]]
["cas",[2322,"Lock:upl_26",-1,1358150395]]
["add",["Lock:upl_26",1358150402000000,86400]]
["get",["Lock:upl_26",null,null]]
["getResultCode",[]]
["cas",[2324,"Lock:upl_26",-1,1358150395]]
["get",["UserAppFriends_26",null,null]]
["add",["Lock:upl_27",1358150402000000,86400]]
["get",["Lock:upl_27",null,null]]
["getResultCode",[]]
["cas",[2326,"Lock:upl_27",-1,1358150395]]
["add",["Lock:upl_27",1358150402000000,86400]]
["get",["Lock:upl_27",null,null]]
["getResultCode",[]]
["cas",[2328,"Lock:upl_27",-1,1358150395]]
["get",["UserAppFriends_27",null,null]]
["add",["Lock:FeatureGroupSaving",1358150405000000,86400]]
["get",["Lock:FeatureGroupSaving",null,null]]
["getResultCode",[]]
["cas",[2330,"Lock:FeatureGroupSaving",-1,1358150395]]
["get",["s_1a31843e698de9ee25ee56866aec3e6e",null,null]]
["delete",["s_1a31843e698de9ee25ee56866aec3e6e"]]
["get",["s_967daed789c8c524bc05b5d20338e3ea",null,null]]
["delete",["s_967daed789c8c524bc05b5d20338e3ea"]]
["get",["s_e891f4cbd4690cae9febd7b9b4367487",null,null]]
["delete",["s_e891f4cbd4690cae9febd7b9b4367487"]]
["get",["s_bc934e351a03d0dc1bac187724f31dc2",null,null]]
["cas",[0,"s_bc934e351a03d0dc1bac187724f31dc2",{"user_id":21,"token_csrf":859884505},3600,true]]
["getResultCode",[]]
["delete",["TestlockTestlib:type_CentralDatabase.id_default"]]
["delete",["TestlockTestlib:type_AllDbSpots.id_default"]]
["delete",["TestlockTestlib:type_Authorizer.id_default"]]
["delete",["TestlockTestlib:type_Memcaches.id_default"]]
["add",["TestlockTestlib:type_CentralDatabase.id_default",true,600]]
["get",["s_4354ac7f7a1c65fc701fb11cfc05235e",null,null]]
["get",["s_8cd4ca8a9b6a983b3fd7214876ab73cb",null,null]]
["get",["included_files_bobrov.pretender.local_3abcd49fa0a0a6708c64c4f28f4afa661c77ac56",null,null]]
["get",["included_files_bobrov.pretender.local_875dfb50a3599435113f0b5ab12d5d7463317675",null,null]]
["add",["s_8cd4ca8a9b6a983b3fd7214876ab73cb",{"user_agent":"check_http\/v1.4.16 (nagios-plugins 1.4.16)"},3600,true]]
["get",[["spot_3",null,null],null,null]]
["get",[["spot_3",null,null],null,null]]
["get",[["spot_3",null,null],null,null]]

It fails on line 87 currently.

memccp should support a --key option

Imported from Launchpad using lp2gh.


Hi,

Please consider adding an option to memccp so users can set the key of the file being loaded to memcached.

This can be very useful to rapidly populate memcached for serving static Web content with nginx, for example.

I've pushed a branch on github with the slasher.diff patch on debian/patches [1] also attached to the bug report.

Also reported on Debian BTS as #712013.

Thanks,
bureado

[1] https://github.com/bureado/libmemcached

auto_response sets value to garbage if rc=NOT_FOUND

Imported from Launchpad using lp2gh.


auto_response executes *value= instance->root->result.numeric_value; even when rc == NOT_FOUND.

The http://docs.libmemcached.org/memcached_auto.html docs only describe "If the object specified by key does not exist" behaviour for the memcached_with_initial variants. However the memcached_with_initial variants can't be used with the textual protocol (but that's not mentioned in the docs.)

(This caused a failure in Cache::Memcached::libmemcached https://rt.cpan.org/Ticket/Display.html?id=88376)

strange check in \libmemcached\virtual_bucket.c

Imported from Launchpad using lp2gh.


uint32_t memcached_virtual_bucket_get(const memcached_st *self, uint32_t digest)
{
  if (self)
  {
    if (self->virtual_bucket)   <=======
    {
      if (self->virtual_bucket)  <=======
      {
        uint32_t result= (uint32_t) (digest & (self->virtual_bucket->size -1));
        return self->virtual_bucket->buckets[result].master;
      }

      return (uint32_t) (digest & (self->number_of_hosts -1));
    }
  }

Impossible to compile against libmemcached without c++11 with GCC 4.9

Imported from Launchpad using lp2gh.


libmemcached is broken in Fedora rawhide and with any compilation implying GCC 4.9.

The header memcache.h exposes "#include " which forces the usage of C++11 r triggers compilation error

https://bugzilla.redhat.com/show_bug.cgi?id=1106145
http://koji.fedoraproject.org/koji/taskinfo?taskID=6951772

https://kojipkgs.fedoraproject.org//work/tasks/7102/6957102/build.log

In file included from /usr/include/c++/4.9.0/cinttypes:35:0,
from /usr/include/libmemcached-1.0/memcached.h:46,
from /usr/include/libmemcached/memcached.h:39,
from /builddir/build/BUILD/dmlite-plugins-memcache-0.6.2/src/Memcache.h:7,
from /builddir/build/BUILD/dmlite-plugins-memcache-0.6.2/src/Memcache.cpp:11:
/usr/include/c++/4.9.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \

This is an urgent fix and block compilation existing software compiling against libmemcached

libmemcached 1.0.17 won't compile on RHEL 6.4

Imported from Launchpad using lp2gh.


Hello,

Unfortunately, I am unable to get libmemcached 1.0.17 to compile on RHEL 6.4. The required version of bison went from 2.4 to 2.5 between the 1.0.16 and 1.0.17 releases. RHEL 6.4 comes with bison 2.4.1. If I just patch the parser.yy file to require version 2.4, I get the following error:

CXX libtest/libtest_libtest_la-runner.lo
CXX libtest/libtest_libtest_la-server.lo
CXX libtest/libtest_libtest_la-server_container.lo
CXX libtest/libtest_libtest_la-signal.lo
libtest/server_container.cc: In member function 'libtest::Server* libtest::server_startup_st::create(const std::string&, in_port_t, bool
)':
libtest/server_container.cc:241: error: 'HAVE_MEMCACHED_BINARY' was not declared in this scope
make[1]: *** [libtest/libtest_libtest_la-server_container.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_construct.h: In destructor 'libtest::Server::~Server()':
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_construct.h:99: warning: assuming that the loop counter do
es not overflow
make[1]: Leaving directory `/builddir/build/BUILD/libmemcached-1.0.17'
make: *** [all] Error 2

I get the same error on RHEL 5.9 without the patch. With the patch I get:

  • make -j4
    GEN libmemcached/csl/scanner.cc
    "libmemcached/csl/scanner.l", line 38: unrecognized '%' directive
    "libmemcached/csl/scanner.l", line 40: bad character: #
    "libmemcached/csl/scanner.l", line 40: unknown error processing section 1
    "libmemcached/csl/scanner.l", line 40: bad character: <
    "libmemcached/csl/scanner.l", line 40: bad character: /
    "libmemcached/csl/scanner.l", line 40: bad character: /
    "libmemcached/csl/scanner.l", line 40: bad character: .
    "libmemcached/csl/scanner.l", line 40: bad character: >
    "libmemcached/csl/scanner.l", line 41: bad character: #
    ...

Please note the RHEL 5.9 comes with bison 2.3. I was able to build libmemcached 1.0.16 on RHEL 5.9 without any issues.

Thanks,

Ben

memslap assertion failure

Imported from Launchpad using lp2gh.


$ memcslap -s 127.0.0.1:11211 -t 1m -T4 --facebook -d 4 -b
servers : 127.0.0.1:11211
threads count: 4
concurrency: 16
run time: 60s
windows size: 10k
set proportion: set_prop=0.10
get proportion: get_prop=0.90
memcslap: clients/ms_conn.c:1462: ms_sort_udp_packet: Assertion `req_id == c->request_id % (1 << 16)' failed.

memslap version 1.0
memcached version 1.4.13

Running on an amazon EC2 instance (various RAM and CPU configurations)
Amazon Linux AMI release 2013.03
Linux ip-10-36-134-3 3.4.37-40.44.amzn1.x86_64 #1 SMP Thu Mar 21 01:17:08 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

SASL authentication fails

Imported from Launchpad using lp2gh.


SASL authentication doesn't work.

When connecting to a server using SASL, we have the following callstack :

  • memcached_connect
  • memcached_sasl_authenticate_connection
  • memcached_response
  • _read_one_response

in function _read_one_response, during SASL authentication, the rc value is set to MEMCACHED_AUTH_CONTINUE.

This value is not considered as a success by memcached_fatal which result in closing the connection to memcached, preventing the authentication to complete properly.

the memcached_fatal function should look like this :

static inline bool memcached_fatal(memcached_return_t rc)
{
return (
rc != MEMCACHED_BUFFERED &&
rc != MEMCACHED_CLIENT_ERROR &&
rc != MEMCACHED_DATA_EXISTS &&
rc != MEMCACHED_DELETED &&
rc != MEMCACHED_E2BIG &&
rc != MEMCACHED_END &&
rc != MEMCACHED_ITEM &&
rc != MEMCACHED_ERROR &&
rc != MEMCACHED_NOTFOUND &&
rc != MEMCACHED_NOTSTORED &&
rc != MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE &&
rc != MEMCACHED_STAT &&
rc != MEMCACHED_STORED &&
rc != MEMCACHED_SUCCESS &&
rc != MEMCACHED_VALUE &&
rc != MEMCACHED_AUTH_CONTINUE);
}

Never reconnect after connection reset (binary protocol)

Imported from Launchpad using lp2gh.


When I restart my memcached server, libmemcached never reconnects as long as I'm continuously trying to send data to it. If the client stops activity for a few seconds then starts sending again, the reconnection happens just fine.

It turns out to be a problem with how next_rety is set. Even when we don't try to connect because it's too soon, we still update next_retry.

That's because the socket is invalid, so the server state is MEMCACHED_SERVER_STATE_NEW, not MEMCACHED_SERVER_STATE_IN_TIMEOUT. memcached_mark_server_for_timeout() only skips updating next_retry in the latter state, not the former.

I'm not sure what the right solution is here. Maybe make memcached_quit_server() idempotent by checking for MEMCACHED_SERVER_STATE_NEW at the start and returing right away? I'm reluctant to do the same in memcached_mark_server_for_timeout(), in case that skips setting it when we really do need to set it.

connect error with cram-md5 sasl

Imported from Launchpad using lp2gh.


can't connect a memcached which just support cram-md5.

bug:

libmemcached-1.0/return.h:62
memcached_fatal(MEMCACHED_AUTH_CONTINUE) returns true;

please fix it, or contact me, i can post a patch to you.

thanks

Lack of docs for default memcached connection loss behaviour

Imported from Launchpad using lp2gh.


I can't seem to find documentation that describes exactly what happens when a server goes down, and how best to handle its graceful recovery.

The documentation for the behaviours seems to assume a certain level of knowledge that I don't have, or at least I'm not sure about. It's a reference manual. I'm looking for a guide.

My question is similar to http://stackoverflow.com/questions/10029432/libmemcached-fail-over-of-a-clusters-node
except that a) I'd like more background information, and b) there's no discussion of handling the recovery of a node.


As an example, the venerable and original Cache::Memcached module (https://metacpan.org/source/DORMANDO/Cache-Memcached-1.30/lib/Cache/Memcached.pm) seems to recalculate the 'buck2sock' mapping (by $socket_cache_generation++;) whenever a socket is marked dead by _dead_sock() being called.

But some of calls to _dead_sock, specifically those from connection setup, also provide a duration ($dead_for) during which the host should be regarded as dead.

So a single communications error on an established socket doesn't remove a server, but does cause a connection drop and reconnect. If that reconnect fails then the server is removed from the buck2sock calculation for a period.

This seems reasonable and is self-repairing. Sadly the libmemcached docs don't seem to discuss this behaviour at all.


I'm rather surprised I can't find this kind of discussion in the libmemcached docs. Am I missing something?

The use-case is simply what I imagine a typical installation would be: a list of memcached servers and consistent hashing enabled.

I was asked that question recently and realised that I wasn't sure and was then doubly surprised by not being able to find it documented.

I'm looking for a simple description of exactly what happens by default in libmemcached when a memcached server goes down (both for a clean tcp close and for a network outage leading to tcp timeouts) and when it comes back again later.

That would provide the background detail against which the various optional behaviours could be explained and understood.

error: comparison between pointer and integer

Imported from Launchpad using lp2gh.


CXX clients/memflush.o
clients/memflush.cc:42:19: error: comparison between pointer and integer ('char *' and 'int')
if (opt_servers == false)
~~~~~~~~~~~ ^ ~~~~~
clients/memflush.cc:51:21: error: comparison between pointer and integer ('char *' and 'int')
if (opt_servers == false)
~~~~~~~~~~~ ^ ~~~~~
2 errors generated.
make[1]: *** [clients/memflush.o] Error 1
make: *** [install] Error 2

synchronization bug in 1.0.16 version

Imported from Launchpad using lp2gh.


I'm using php with memcached 2.1, libmemcached 1.0.16 and memcache server 1.4

I wrote the following script, which results in some key persistance

<?php
class mem{
        public $mem = null;
        public static $x = 0;

        public function __construct()
        {
                $this->mem = new Memcached();
                $this->mem->addServer("localhost",11211);
                $op = $this->mem->add("key_".self::$x, "test");
        }
        public function __destruct()
        {
                $op = $this->mem->delete("key_".self::$x);
                $this->mem = null;
                self::$x++;
        }
}
for($i=0;$i<100000;$i++){
$v = new mem();
}
?>

When this script runs, I found that 5-10 keys were not being deleted and when i run the same script with memcached 2.0, libmemcached 0.48, keeping the same memcache server every key is deleted.
Moreover when i use concurrent execution of the same script, the key persistance number grows exponentially.

I watched the memcached library code but didn't find much difference. I think it has to do some with libmemcached....

Please give me some explanation for this behavior

memcp gets expiration time wrong

Imported from Launchpad using lp2gh.


The memcp (memccp on Debian systems) command line utility gets the supplied expire time wrong:

memcp --verbose --servers=localhost --set --expire=1418563176 "foo:bar"
op: set
source file: foo:bar
length: 4
key: foo:bar
flags: 0
expires: 86307647862
Calling memcached_free()

Providing a value of 54900000 leads to 1418723328, which brings me very near to my desired expiration time of 1418563176.

I tested this on Mac OS X 10.8.5 and Linux Debian 7.2.

memcached_fetch_result can return previously returned data

Imported from Launchpad using lp2gh.


I think I've found the cause....

In memcached_instance_st::close_socket(), we reset read_buffer_length and read_ptr, but not read_data_length. So, read_data_length says we still have lots of data in the buffer, whereas read_data_length says it's empty.

If repack_input_buffer is called, we'll skip the initial "if" statement, then we'll try to read some more, but put the data at read_ptr + read_data_length, i.e. not at the start of the buffer, but further along.

I think I'm actually seeing this bug in practice. At least, I'm seeing old keys being returned by new requests in the presence of servers going away and coming back.

ensures the consistent hash cycle unchanged when collide

Imported from Launchpad using lp2gh.


When the virtual node A and virtual node B collides, the order of A and B on the consistent hash cycle is undetermined.
Because of different implementation of sort functions in various languages or unstable sort algorithm like quick sort,
the order of A and B may be different in different clients(e.g. Client X, Client Y).

It could cause such a serious problem:
Client X : set foo hello
Client Y : get foo
with a small probability:
the client X's key(foo) point to node A, while the client Y's key point to node B.

Thus, all the keys that point to node B in Client Y will fail when doing Get commands.

It will be better if the flag of use_sort_hosts gets set, which makes the comparing of index(in the patch) meaningful even when servers order in the configure rearranged.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.