I was getting this error on java-client-2.1.0
while trying to work with AsyncBucket
:
com.couchbase.client.deps.io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
After a while I figured it out. Couchbase completely ignores this scenario so there's no proper feedback from the library and the Netty internals aren't helping.
Turns out you'll get that error when consuming CB's items more than once. For example,
That is the only way I could come up with to handle a "document not found" scenario.
To work around this, use
cache()
:The caching observer will consume the Couchbase's item and then the multiple subscribers can safely consume from the cache.
If you're using
rxscala
, the fix is the same.Would fail without the cache.