Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
Security Level: Public
-
None
-
PHP client DP3
Description
Problem Summary:
When writing more than 1MB of data using php libcouch client, the client itself does not process the object too large error and the libcouchbase library logs a PHP warning as "PHP Warning: Couchbase::set(): Failed to store a value to server: Object too big in.....".
As result, it's impossible to write a strict warning free high performance php app using the current setup when we can't control what data is attempted to be cached.
1) We cannot catch this error before passing data in since more >1MB data might be compressible to less than <1MB so we have to rely on the PHP Client to do this for us.
2) We cannot catch this on the client site since it's not an exception but a PHP error/warning.
3) We can use set_error_handler() in php to catch this but it is extremely slow and negates the performance advantage of having libcouchbase in the first place.
Recommendation:
1) Return FALSE from PHP Client if post-compressed data is more than 1MB.
/* INSERT CODE test for payload_len size here before calling line below, if more, than return FALSE */
if (!(payload = php_couchbase_zval_to_payload(value, &payload_len, &flags, couchbase_res->serializer, couchbase_res->compressor TSRMLS_CC)))
{ RETURN_FALSE; }Notes: pecl-memcached using libmemcached lib does not throw PHP warnings when object size is over limit. Error is logged internally and is up to the programmer to read the error post-fail to determine what happened.