Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1522

ClusterTimeoutOptions not respected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • None
    • None
    • None
    • 0

    Description

      To reproduce

      from datetime import timedelta
      from couchbase.cluster import Cluster
      from couchbase.options import ClusterOptions, ClusterTimeoutOptions
      from couchbase.auth import PasswordAuthenticator
       
      opts = ClusterOptions(PasswordAuthenticator('Administrator', 'password'), timeout_options=ClusterTimeoutOptions(analytics_timeout=timedelta(seconds=5)))
      cluster = Cluster('couchbase://localhost', opts)
      result = cluster.analytics_query('select value sleep("result", 100000)')
      for row in result:
          print(f"Row: {row}")

      This should have timed out at 5 seconds. It does not, it times out after 75 seconds which is the default analytics timeout, so it looks like the analytics timeout set through the ClusterTimeoutOptions is not respected. From an initial look, it seems that something similar applies to all timeouts in ClusterTimeoutOptions.

      The cause appears to be that even though the timeout options are appended to the cluster options and the 'timeout_options' key is removed (see 1), on the C++ side we are trying to find the 'timeout_options' key (see 2).

      (1) couchbase/logic/options.py

      timeout_opts = kwargs.pop('timeout_options', {})
      if timeout_opts:
          for k, v in timeout_opts.items():
              if k not in kwargs:
                  kwargs[k] = v 

      (2) src/connection.cxx

      PyObject* pyObj_timeout_opts = PyDict_GetItemString(pyObj_options, "timeout_options");
      if (pyObj_timeout_opts != nullptr) {
          update_cluster_timeout_options(options, pyObj_timeout_opts);
      } 

      Attachments

        Issue Links

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

          Activity

            People

              Dimitris.Christodoulou Dimitris Christodoulou
              Dimitris.Christodoulou Dimitris Christodoulou
              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