Couchbase python SDK memory leaking for simple KV get operation

We have problem in our applications with memory consumption after upgrade to python client SDK version 3.2.*. Simple get operation in a while iteration is consuming more and more memory.

Example code:

from couchbase.cluster import Cluster, ClusterOptions
from couchbase.auth import PasswordAuthenticator
cluster = Cluster('couchbase://some-cluster?enable_tracing=false', ClusterOptions(PasswordAuthenticator('xxx', 'xxx')))

cb = cluster.bucket('xxx')
cb_coll_default = cb.default_collection()
cb_coll_default.upsert(str(123), '123')
for i in range(10000000):
  try:
    cb_coll_default.get(str(123))
  except Exception:
    pass

Have anyone the same experiences?

Hi @petr.zelenka , welcome to the forum!

As per the following forum article, can you confirm that you are running the latest Couchbase Python SDK:
https://forums.couchbase.com/t/memory-leak-with-python-couchbase-2-5-0/21055/10
With python sdk version [3.2.4], this problem is fixed.
Just upgrade sdk to version 3.2.4 with
python3 -m pip install --upgrade couchbase

The relevant Jira issue ticket is here:
https://issues.couchbase.com/browse/PYCBC-995

And the fix commit here:
https://github.com/couchbase/couchbase-python-client/commit/e5e2f732f887e9342bc91799d6c7b034698ffe53

I hope that helps!

I have tried all versions from 3.0.0 up to 3.2.6 and I have the same issue. There is no problem in old 2.5 SDK version.

Hi @petr.zelenka

I have been able to reproduce the issue you have seen. You can follow the progress of the issue here https://issues.couchbase.com/browse/PYCBC-1282

Hi @petr.zelenka - Just want to give an update that we released version 4.0.3 of the SDK yesterday which includes a fix for this issue.