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

PHP Couchbase persistent connections shares more than expected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.0.0-dp1
    • None
    • library
    • Security Level: Public
    • None

    Description

      PHP Couchbase persistent connection shares all option settings (serializer, compression, prefix_key) and keeps that settings across multiple requests. This is not an expected behaviour.

      Code:

      <?php
      $cb1 = new Couchbase("http://192.168.0.180/default");
      $cb2 = new Couchbase("http://192.168.0.180/default");

      $cb1->setOption(COUCHBASE_OPT_PREFIX_KEY,'cb1');
      $cb2->setOption(COUCHBASE_OPT_PREFIX_KEY,'cb2');

      $cb1->set('val1','v1', 60);
      $cb2->set('val2','v2', 60);
      ?>

      will store following keys:

      cb2_val1
      cb2_val2

      Moreover if you execute right after previous request following code (in another script):

      <?php
      $cb = new Couchbase("http://192.168.0.180/default");
      $cb->set('val3','v3', 60);
      ?>

      the code stores key:

      cb2_val3

      If you turn off the persistent connections, you will get more consistent results:

      cb1_val1
      cb2_val2
      val3

      The problem is that whole _php_couchbase_res structure is shared when using persistent connection. Possible change is to duplicate this structure in php_couchbase_create_impl. But resource destructors should be modified according to this change.

      Attachments

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

        Activity

          People

            brett19 Brett Lawson
            jtulach jtulach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty