[PCBC-139] PHP client needs fastlz compression to be compatible with legacy memcached clients Created: 01/Nov/12  Updated: 26/Aug/13  Resolved: 16/Nov/12

Status: Resolved
Project: Couchbase PHP client library
Component/s: library
Affects Version/s: 1.0.4
Fix Version/s: 1.1.0
Security Level: Public

Type: Bug Priority: Blocker
Reporter: Tim Smith (Inactive) Assignee: Trond Norbye
Resolution: Fixed Votes: 0
Labels: customer
Remaining Estimate: 16h
Time Spent: Not Specified
Original Estimate: 16h
Environment: With both php-ext-couchbase-1.0.5-centos55-x86_64.tar.gz and php-ext-couchbase-1.0.6b23_centos-5.5-x64.tar.gz. I will attach php -i output as a separate comment. Using php-pecl-memcached extension 1.0.0. libmemcached 1.0.4.

Attachments: GZip Archive couchbase.so.gz    
Issue Links:

The existing memcached clients for PHP (pecl-memcached and memcache) both default to using fastlz compression for values >= 2000 bytes.

The couchbase client library doesn't have fastlz compression included. It doesn't provide a useful error message when it runs into this problem. Instead, it misinterprets the stored value, tries to allocate a huge block of memory and fails. The error it gives (look, e.g., in the PHP-FPM web-access.log) is:

[01-Nov-2012 20:45:49 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8460104323416721361 bytes) in /usr/share/nginx/html/cb.php on line 32

To reproduce, just set a value >= 2000 bytes with pecl-memcached client, and try to read it with Couchbase client. Here's a sample:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Couchbase Server PHP Test</title>


$host = "";
$user = "Administrator";
$password = "password";
$bucketName = "default";
$persistConnection = false;
$cb = new Couchbase($host . ":8091",
        $user, $password, $bucketName, $persistConnection);

$mc = new Memcached('Pool-1');
if (count($mc->getServerList()) == 0) {
    // No servers, this pool needs to be configured
    $mc->addServer($host, 11211);
    //$mc->addServer("other host", 11211);

// Change this to 1999 and it will work
$valLength = 2000;
$val = date(DateTime::RFC2822) . ' ';
$val .= str_repeat('X', $valLength - strlen($val));

$mc->set("a", $val);
echo("The value for 'a' is: ");


The correct behavior is for the Couchbase client to ship, out of the box, compatible with existing Memcached client implementations. It should include fastlz support directly, or else clearly document how to add such support without requiring any unusual compilations or other hoops. The fastlz code is very small and portable, and hasn't changed since 2007, so it should present a minimal maintenance issue.

In addition, the PHP client documentation should clearly indicate what changes are needed in order for the client to be compatible with the other Couchbase clients (Java, .NET, etc.). Again, without requiring recompilation or extra hoops to jump through.

Comment by Tim Smith (Inactive) [ 01/Nov/12 ]
PHP Version => 5.3.15

System => Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:43 EDT 2012 x86_64
Build Date => Jul 20 2012 13:07:19
Configure Command => './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' '--enable-force-cgi-redirect' '--libdir=/usr/lib64/php' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--enable-mysqlnd=shared' '--with-mysql=shared,mysqlnd' '--with-mysqli=shared,mysqlnd' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-oci8=shared,instantclient,/usr/lib64/oracle/11.2/client64/lib,11.2' '--with-pdo-oci=shared,instantclient,/usr,11.2' '--with-interbase=shared,/usr/lib64/firebird' '--with-pdo-firebird=shared,/usr/lib64/firebird' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--without-sqlite3' '--with-sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--without-readline' '--with-libedit' '--with-pspell=shared' '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/usr' '--with-enchant=shared,/usr' '--with-recode=shared,/usr'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed => /etc/php.d/curl.ini,

PHP API => 20090626
PHP Extension => 20090626
Zend Extension => 220090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies




BZip2 Support => Enabled
Stream Wrapper support => compress.bzip2://
Stream Filter support => bzip2.decompress, bzip2.compress
BZip2 Version => 1.0.3, 15-Feb-2005


Calendar support => enabled


PHP Version => 5.3.15

Directive => Local Value => Master Value
allow_call_time_pass_reference => Off => Off
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => Off => Off
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => Off => Off
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => 22527 => 22527
exit_on_timeout => Off => Off
expose_php => On => On
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules
file_uploads => On => On
highlight.bg => <font style="color: #FFFFFF">#FFFFFF</font> => <font style="color: #FFFFFF">#FFFFFF</font>
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style="color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style="color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style="color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .:/usr/share/pear:/usr/share/php => .:/usr/share/pear:/usr/share/php
log_errors => On => On
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => Off => Off
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.add_x_header => On => On
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
memory_limit => 128M => 128M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 16K => 16K
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => Off => Off
report_memleaks => On => On
report_zend_debug => Off => Off
request_order => GP => GP
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => 100 => 100
short_open_tag => Off => Off
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
variables_order => GPCS => GPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.enable_gc => On => On


couchbase support => enabled
version => 1.0.5
json support => yes
fastlz support => no
zlib support => yes

Directive => Local Value => Master Value
couchbase.compression_factor => 1.3 => 1.3
couchbase.compression_threshold => 2000 => 2000
couchbase.compressor => none => none
couchbase.serializer => php => php


ctype functions => enabled


cURL support => enabled
cURL Information => 7.15.5
Age => 2
AsynchDNS => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
Largefile => Yes
NTLM => Yes
SSL => Yes
SSPI => No
krb4 => No
libz => Yes
CharConv => No
Protocols => tftp, ftp, telnet, dict, ldap, http, file, https, ftps
Host => x86_64-redhat-linux-gnu
SSL Version => OpenSSL/0.9.8b
ZLib Version => 1.2.3


date/time support => enabled
"Olson" Timezone Database Version => 0.system
Timezone Database => internal
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in Unknown on line 0
Default timezone => America/Los_Angeles

Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => no value => no value


Regex Library => Bundled library enabled


EXIF Support => enabled
EXIF Version => 1.4 $Id$
Supported EXIF Version => 0220
Supported filetypes => JPEG,TIFF

Directive => Local Value => Master Value
exif.decode_jis_intel => JIS => JIS
exif.decode_jis_motorola => JIS => JIS
exif.decode_unicode_intel => UCS-2LE => UCS-2LE
exif.decode_unicode_motorola => UCS-2BE => UCS-2BE
exif.encode_jis => no value => no value
exif.encode_unicode => ISO-8859-15 => ISO-8859-15


fileinfo support => enabled
version => 1.0.5-dev


Input Validation and Filtering => enabled
Revision => $Id: 2b8c730d7dfaa8485d07cd792f0c82852ffe4113 $

Directive => Local Value => Master Value
filter.default => unsafe_raw => unsafe_raw
filter.default_flags => no value => no value


FTP support => enabled


GetText Support => enabled


gmp support => enabled
GMP version => 4.1.4


hash support => enabled
Hashing Engines => md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b salsa10 salsa20 haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5


iconv support => enabled
iconv implementation => glibc
iconv library version => 2.5

Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1


igbinary support => enabled
igbinary version => 1.1.1
igbinary APC serializer ABI => 0

Directive => Local Value => Master Value
igbinary.compact_strings => On => On


json support => enabled
json version => 1.2.1


libXML support => active
libXML Compiled Version => 2.6.26
libXML Loaded Version => 20626
libXML streams => enabled


memcached support => enabled
Version => 2.1.0
libmemcached version => 1.0.4
Session support => yes
igbinary support => yes
json support => yes

Directive => Local Value => Master Value
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.serializer => igbinary => igbinary
memcached.sess_binary => 0 => 0
memcached.sess_lock_wait => 150000 => 150000
memcached.sess_locking => 1 => 1
memcached.sess_prefix => memc.sess.key. => memc.sess.key.


MHASH support => Enabled
MHASH API Version => Emulated Support


OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
OpenSSL Header Version => OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008


pcntl support => enabled


PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.12 2011-01-15

Directive => Local Value => Master Value
pcre.backtrack_limit => 1000000 => 1000000
pcre.recursion_limit => 100000 => 100000


Phar: PHP Archive support => enabled
Phar EXT version => 2.0.1
Phar API version => 1.1.1
SVN revision => $Id: f7d08da4ab9e515975840c28b830edc9437c3026 $
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
gzip compression => enabled
bzip2 compression => enabled
Native OpenSSL support => enabled

Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Directive => Local Value => Master Value
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On


Reflection => enabled
Version => $Id: e98652ba2326bd9391b730afdaf96c017d9fab48 $


Session Support => enabled
Registered save handlers => files user memcached
Registered serializer handlers => php php_binary igbinary

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.bug_compat_42 => Off => Off
session.bug_compat_warn => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => no value => no value
session.entropy_length => 0 => 0
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 5 => 5
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => /var/lib/php/session => /var/lib/php/session
session.serialize_handler => php => php
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_trans_sid => 0 => 0


shmop support => enabled


Simplexml support => enabled
Revision => $Id: a379111021e24ef020a2eefd8ca830cb1ab5b280 $
Schema support => enabled


Sockets Support => enabled


SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException


Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=href,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value


Tokenizer Support => enabled


XML Support => active
XML Namespace Support => active
libxml2 Version => 2.6.26


Zip => enabled
Extension Version => $Id$
Zip version => 1.11.0
Libzip version => 0.10.1


ZLib Support => enabled
Stream Wrapper support => compress.zlib://
Stream Filter support => zlib.inflate, zlib.deflate
Compiled Version => 1.2.3
Linked Version => 1.2.3

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name


Variable => Value
HOSTNAME => localhost.localdomain
TERM => xterm-256color
SHELL => /bin/bash
HISTSIZE => 1000
SSH_CLIENT => 62308 22
SSH_TTY => /dev/pts/1
USER => root
SSH_AUTH_SOCK => /tmp/ssh-RpQDiY3683/agent.3683
MAIL => /var/spool/mail/root
PATH => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD => /usr/share/nginx/html
LANG => en_US.UTF-8
SSH_ASKPASS => /usr/libexec/openssh/gnome-ssh-askpass
SHLVL => 1
HOME => /root
LOGNAME => root
SSH_CONNECTION => 62308 22
LESSOPEN => |/usr/bin/lesspipe.sh %s
_ => /usr/bin/php
OLDPWD => /root/php-lib

PHP Variables

Variable => Value
_SERVER["HOSTNAME"] => localhost.localdomain
_SERVER["TERM"] => xterm-256color
_SERVER["SHELL"] => /bin/bash
_SERVER["SSH_CLIENT"] => 62308 22
_SERVER["SSH_TTY"] => /dev/pts/1
_SERVER["USER"] => root
_SERVER["SSH_AUTH_SOCK"] => /tmp/ssh-RpQDiY3683/agent.3683
_SERVER["MAIL"] => /var/spool/mail/root
_SERVER["PATH"] => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
_SERVER["PWD"] => /usr/share/nginx/html
_SERVER["LANG"] => en_US.UTF-8
_SERVER["SSH_ASKPASS"] => /usr/libexec/openssh/gnome-ssh-askpass
_SERVER["HOME"] => /root
_SERVER["LOGNAME"] => root
_SERVER["LESSOPEN"] => |/usr/bin/lesspipe.sh %s
_SERVER["_"] => /usr/bin/php
_SERVER["OLDPWD"] => /root/php-lib
_SERVER["REQUEST_TIME"] => 1351803847
_SERVER["argv"] => Array

_SERVER["argc"] => 0

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.
Comment by Tim Smith (Inactive) [ 02/Nov/12 ]
It doesn't work even when the extension is compiled to use fastlz compression.

I recompiled php-ext-couchbase from git with current libcouchbase code, and configured to include fastlz support. I set couchbase.compressor=fastlz in php.ini. And the couchbase.compression_threshold is at 2000, same as the memcached extension setting.

Excerpt of phpinfo() for the couchbase extension:

couchbase support enabled
version 1.1.0-dp5
json support yes
fastlz support yes
zlib support yes

Directive Local Value Master Value
couchbase.compression_factor 1.3 1.3
couchbase.compression_threshold 2000 2000
couchbase.compressor fastlz fastlz
couchbase.serializer php php

The same test case fails in the same way:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 7598212603105511377 bytes) in /usr/share/nginx/html/cb.php on line 35

Comment by Tim Smith (Inactive) [ 02/Nov/12 ]
By the way, in order to compile with fastlz support, the following patch is needed:

diff --git a/couchbase.c b/couchbase.c
index 240ba3e..f4c14e5 100644
--- a/couchbase.c
+++ b/couchbase.c
@@ -41,6 +41,8 @@
 #include <libcouchbase/couchbase.h>
 #include "php_couchbase.h"
+# include "fastlz.h"
+/* Any other code that uses fastlz_* should only include the header */
 # include "fastlz.c"
diff --git a/views.c b/views.c
index 395cc2b..e818473 100644
--- a/views.c
+++ b/views.c
@@ -19,7 +19,7 @@
 #include <libcouchbase/couchbase.h>
 #include "php_couchbase.h"
-# include "fastlz.c"
+# include "fastlz.h"
 # include "zlib.h"

Otherwise linking couchbase.so fails because the fastlz functions are defined in more than one place.
Comment by Mark Nunberg [ 02/Nov/12 ]
Fixes for this are in progress.

http://review.couchbase.org/#/c/20604/ (in progress) fixes some of the crazy allocation attempts you've seen.

As for fastlz support, it shouldn't be too difficult to add it on.
Comment by Mark Nunberg [ 06/Nov/12 ]
A binary is attached. It's not compiled against the exact same version of php, but the zend api versions remain the same.

If the binary release doesn't work, I'd be happy to walk someone through building it from source (it's a very simple process -- much simpler than getting this binary built).
Comment by Mark Nunberg [ 06/Nov/12 ]
Note this is for the 1.1-dp php-ext branch. I've yet to backport this to the 1.0 branch
Comment by Matt Ingenthron [ 07/Nov/12 ]
Mark: Please determine if this issue is still valid and help me triage it into the appropriate release. I've assigned it to you for triage, not necessarily to fix it.
Comment by Mark Nunberg [ 07/Nov/12 ]
Awaiting approval on http://review.couchbase.com/22340

The is fixed in the code. Still needs backport to 1.0.x

Assigning back to you
Comment by Mark Nunberg [ 07/Nov/12 ]
http://review.couchbase.org/#/c/22340/ (1.1)
Comment by Matt Ingenthron [ 12/Nov/12 ]
Awaiting verification fix from customer.
Comment by Matt Ingenthron [ 14/Nov/12 ]
Trond: can you take care of backporting this to 1.0.x please?
Comment by Tim Smith (Inactive) [ 15/Nov/12 ]
More detail. I was personally unable to get the build of the latest PHP code to work with the beta2 release. I was hitting the error that is reported on http://www.couchbase.com/issues/browse/CCBC-126 :

Warning: Couchbase::__construct() [couchbase.--construct]: failed to create IO instance in /usr/share/nginx/html/cb.php on line 18

Building from sources let me get past that and actually test the build that the customer was trying. And following from that was a need to deal with LD_LIBRARY_PATH and symlink hacks.

A backport of the fastlz compression fix to 1.0.x, with an official release of that, would be best for this particular user's needs. Can we get an ETA on when that will be available?


Comment by Trond Norbye [ 16/Nov/12 ]
For 1.0.x: http://review.couchbase.org/#/c/22590/
Comment by Tim Smith (Inactive) [ 16/Nov/12 ]
I've confirmed it to work (using the current 1.0.x branch from github.com/couchbase/php-ext-couchbase).

I had to create a fake /usr/lib64/libvbucket.la to get it to compile: http://www.couchbase.com/issues/browse/CCBC-127

I noticed that compress.c has this redundant (unused) definition:

 92 /* headers which claim an uncompressed size above this figure are bad */
 93 #define DECOMP_SANITY_LIMIT 0x40000000

And this inaccurate comment:

172 /**
173 * sanity check, don't allocate over a GB, we should make this number
174 * smaller though
175 */

Obviously minor cleanup stuff, nothing significant that I can spot.

Would be great to get a 1.0.x package built and available for download with this (and other critical fixes, like PCBC-75) available to customers. Is there an ETA on when that can be done?

Comment by Matt Ingenthron [ 16/Nov/12 ]
Packages are being uploaded to the site right now. Web page update to follow. Release notes will go up on Monday.

[PCBC-130] Remove mention of pecl-memcache and pecl-memcached from http://www.couchbase.com/develop Created: 14/Jun/12  Updated: 16/Apr/13  Resolved: 16/Apr/13

Status: Resolved
Project: Couchbase PHP client library
Component/s: docs
Affects Version/s: 1.1.0
Fix Version/s: 1.1.3
Security Level: Public

Type: Bug Priority: Major
Reporter: Perry Krug Assignee: Matt Ingenthron
Resolution: Fixed Votes: 0
Labels: customer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Is this docs or client library?

Anyway, a customer somehow missed the big "PHP 1.0" link at the top of the page and thought that he had to use pecl-memcache*. let's remove those now that we have native PHP support.

Comment by Matt Ingenthron [ 15/Oct/12 ]
The reason I did that is I wanted to communicate that we're compatible there, since pecl-memcache (not so much memcached, since we're compatible there) is so popular.

I think I'd rather leave it, but make it more clear some other way. Do you think an additional sentence or two would do it?
Comment by Matt Ingenthron [ 16/Apr/13 ]
With recent website changes, it got worse so I just removed them. Also, we're now in PECL, with plans to fully be in PECL soon.

[PCBC-68] client getting NOT FOUND error for items which are present Created: 17/May/12  Updated: 17/May/12  Resolved: 17/May/12

Status: Resolved
Project: Couchbase PHP client library
Component/s: library
Affects Version/s: None
Fix Version/s: None
Security Level: Public

Type: Bug Priority: Major
Reporter: Tim Smith (Inactive) Assignee: Jan Lehnardt (Inactive)
Resolution: Won't Fix Votes: 0
Labels: customer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: libmemcached 1.0.2 and pecl memached 2.x
Couchbase Server 1.8.0, single node (test) or several nodes (seen in production)

Attachments: File mediaArmorLoadGeneratopr.tar    

A load generator test shows the client getting NOT FOUND errors when getting values that have just been set. A manual check shows the values are there.

If the server or moxi is overloaded, or there are too many connections on the host, it should return a timeout, connection error, server down, etc. But not a NOT FOUND error, which prevents the client from dealing properly with the underlying error.

Also, moxi should provide some message in its error logs if there is a connection problem.

With the test case scenario, this NOT FOUND error went away when switching to persistent connections in the new Memcached() call. So it seems some other (connection-related) error is being converted to NOT FOUND incorrectly.

Comment by Tim Smith (Inactive) [ 17/May/12 ]
Load generator, simple PHP app. Using with pecl-memcached PHP extension, and libmemcached.

Test run in EC2, single-node Couchbase 1.8 cluster, test app running on the same node connecting to localhost:11211.

Comment by Matt Ingenthron [ 17/May/12 ]
This Jira project is about the Couchbase PHP client library, which uses libcouchbase. We can assist with this issue, but the issue you're describing herein is not a bug on this project.

[PCBC-61] Couchbase PHP vs ext/memcached compatibility Created: 02/Apr/12  Updated: 10/May/12  Resolved: 10/May/12

Status: Closed
Project: Couchbase PHP client library
Component/s: library
Affects Version/s: 1.0
Fix Version/s: 1.0.3
Security Level: Public

Type: Bug Priority: Major
Reporter: Perry Krug Assignee: Jan Lehnardt (Inactive)
Resolution: Fixed Votes: 0
Labels: customer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File test.out     File test.php    

Here is a sample script that demonstrates the problem:


// configure Memcached to talk to bejc bucket
$mc = new Memcached();
$mc->addServer("mem1-bjb.test.vte.customer.com", 11214);
// configure Couchbase to talk to becj bucket
$cb = new Couchbase("mem1-bjb.test.vte.customer.com:8091", "", "", "bejc");

echo "Setting testKeyOne with Memcached\n";
$mc->set("testKeyOne", "testValueOne");

echo "Getting testKeyOne with Memcached\n";

echo "Getting testKeyOne with Couchbase\n";

echo "----------\n";

echo "Setting testKeyTwo with Couchbase\n";
$cb->set("testKeyTwo", "testValueTwo");

echo "Getting testKeyTwo with Couchbase\n";

echo "Getting testKeyTwo with Memcached\n";


You need to have a Couchbase server setup with a Couchbase bucket type. Alter server names and ports/buckets to match your setup.

Save the script in a file called test.php and then run it: php test.php

The output should look something like the following:

Setting testKeyOne with Memcached
Getting testKeyOne with Memcached
string(12) "testValueOne"
Getting testKeyOne with Couchbase
Setting testKeyTwo with Couchbase
Getting testKeyTwo with Couchbase
string(12) "testValueTwo"
Getting testKeyTwo with Memcached

The script requires the Couchbase PHP library and the Memcached library to be installed.

On Debian/Ubuntu you can install the Memcached library by running:

apt-get install php5-memcached

Because of the size of our code base we need to slowly migrate to the Couchbase library so interoperability is needed. For example while we may update the actual game code to use Couchbase it might take us a while to update the CS Tools that we use to solve customer problems.

Comment by Sergey Avseyev [ 24/Apr/12 ]
The script which tests new compatibility patch
Comment by Sergey Avseyev [ 24/Apr/12 ]
I've made a patch which fixes compatibility http://review.couchbase.org/15133

But there are features which implemented in memcached but missing in the couchbase extension. like igbinary serializer
Comment by Jan Lehnardt (Inactive) [ 24/Apr/12 ]
@Sergey, The patch looks good, just, as noted on gerrit, it makes test/010.phpt fail.

We deliberately didn't implement all the serialisation methods from ext/memcached, including igbianry. If they are requested, we are happy to look into adding them :)
Comment by Perry Krug [ 24/Apr/12 ]
Thanks guys, can I send something back to the customer to have them verify?
Comment by Matt Ingenthron [ 26/Apr/12 ]
Verification supplied via email.

Generated at Thu Sep 18 03:33:37 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.