Value not returned by call to "get" function

Using Couchbase Java client library version 1.1.2 against Couchbase server 1.8, periodically the library fails to return a value for the following key using the “get” function on the CouchbaseClient:

cfg:-r_/mgr/cpath/-r_/-s_

Are there any reasons why the “get” function would fail to return the value?

Hello,

No reason, if the key is present it should work.

Could you update your Java Client to the latest release? (1.1.7)

This release is compatible with Couchbase 1.8 too.

Let me know…

regards
Tug
@tgrall

Also note that you may want to double check that any exception handlers are doing what you’d expect. You can also replace your synchronous .get() call with .asyncGet() to get more details returned from the server on the Future object returned.

@tgrall I upgraded to the latest client version (1.1.8) but it didn’t work.

@ingenthr I tried your suggestion to use the asyncGet instead of get and it appears to work. It now calls asyncGet, waits until either the operation is done or it is cancelled, then it returns the result. Thanks.

I noticed that the call to asyncGet was causing long delays in my application, so I decided to re-investigate why the call to get didn’t return a value. I created a small Java application that does the following:

  • connects to the Couchbase server
  • reads the value of a key
  • reads the value of another key that contains the value of the key above
  • reads the value of another key that contains the value of the key above
  • shuts down the connection

The above actions are performed 1000 and, out of the 3000 key reads approximately 8 - 10 reads fail each time. I tried increasing the timeouts but that didn’t work. There are also no timeout exceptions thrown by the client. I added some extra Couchbase client logging to the application:

Successfully read value:

Sep 12, 2013 10:38:46 AM net.spy.memcached.MemcachedConnection handleIO FINE: Handling IO for: sun.nio.ch.SelectionKeyImpl@951aeb (r=true, w=false, c=false, op={QA sa=gallium.es.cpth.ie/10.128.16.69:11210, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: 0 Opaque: 20 Key: cfg:-r_/mgr/cpath/-r_/-s_, topWop=null, toWrite=0, interested=1}) Sep 12, 2013 10:38:46 AM net.spy.memcached.MemcachedConnection handleReads FINE: Read 65 bytes Sep 12, 2013 10:38:46 AM net.spy.memcached.protocol.binary.OperationImpl readFromBuffer FINE: Reading 24 header bytes Sep 12, 2013 10:38:46 AM net.spy.memcached.protocol.binary.OperationImpl readFromBuffer FINE: Reading 41 payload bytes Sep 12, 2013 10:38:46 AM net.spy.memcached.protocol.BaseOperationImpl transitionState FINE: Transitioned state from READING to COMPLETE Sep 12, 2013 10:38:46 AM net.spy.memcached.MemcachedConnection handleReads FINE: Completed read op: Cmd: 0 Opaque: 20 Key: cfg:-r_/mgr/cpath/-r_/-s_ and giving the next 0 bytes Sep 12, 2013 10:38:46 AM net.spy.memcached.protocol.TCPMemcachedNodeImpl fixupOps FINE: Setting interested opts to 0 Sep 12, 2013 10:38:46 AM net.spy.memcached.MemcachedConnection handleIO FINE: Done dealing with queue. Sep 12, 2013 10:38:46 AM net.spy.memcached.MemcachedConnection handleIO FINE: Selecting with delay of 0ms -> Read value: [-1fde9d1e-d3b3-4545-9b74-ff7018f4df8d]

Failed read value:

Sep 12, 2013 10:39:02 AM net.spy.memcached.MemcachedConnection handleIO FINE: Handling IO for: sun.nio.ch.SelectionKeyImpl@16e669f (r=true, w=false, c=false, op={QA sa=gallium.es.cpth.ie/10.128.16.69:11210, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: 0 Opaque: 864 Key: cfg:-r_/mgr/cpath/-r_/-s_, topWop=null, toWrite=0, interested=1}) Sep 12, 2013 10:39:02 AM net.spy.memcached.MemcachedConnection handleReads FINE: Read 33 bytes Sep 12, 2013 10:39:02 AM net.spy.memcached.protocol.binary.OperationImpl readFromBuffer FINE: Reading 24 header bytes Sep 12, 2013 10:39:02 AM net.spy.memcached.protocol.binary.OperationImpl readFromBuffer FINE: Reading 9 payload bytes Sep 12, 2013 10:39:02 AM net.spy.memcached.protocol.BaseOperationImpl transitionState FINE: Transitioned state from READING to COMPLETE Sep 12, 2013 10:39:02 AM net.spy.memcached.MemcachedConnection handleReads FINE: Completed read op: Cmd: 0 Opaque: 864 Key: cfg:-r_/mgr/cpath/-r_/-s_ and giving the next 0 bytes Sep 12, 2013 10:39:02 AM net.spy.memcached.protocol.TCPMemcachedNodeImpl fixupOps FINE: Setting interested opts to 0 Sep 12, 2013 10:39:02 AM net.spy.memcached.MemcachedConnection handleIO FINE: Done dealing with queue. Sep 12, 2013 10:39:02 AM net.spy.memcached.MemcachedConnection handleIO FINE: Selecting with delay of 0ms -> Failed to read key: [-r_, mgr, cpath, -r_, -s_]

Any ideas?