Uploaded image for project: 'Couchbase PHP client library'
  1. Couchbase PHP client library
  2. PCBC-104

PHP Client Need to Catch and Process "Object Too Large"errors from libcouchbase


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Security Level: Public
    • Labels:
    • Environment:
      PHP client DP3


      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.


      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.

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.


        xing xing created issue -
        ingenthr Matt Ingenthron made changes -
        Field Original Value New Value
        Assignee Matt Ingenthron [ ingenthr ] Trond Norbye [ trond ]
        Fix Version/s 1.1.0 [ 10242 ]
        trond Trond Norbye made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        brett19 Brett Lawson made changes -
        Workflow jira [ 20353 ] Couchbase SDK Workflow [ 44319 ]


          • Assignee:
            trond Trond Norbye
            xing xing
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created:

              Gerrit Reviews

              There are no open Gerrit changes