Getting null returns from GetView


#1

Using .NET SDK 1.3.12 i sometimes get null replies in one service, but not the other when using the SDK the same way.

I use the following code:
var data = _couchbase.GetView(“keysessions”, “by_keyId”, true).Key(key_id);
var keySession = data.First();
_log.Debug("KeySession Loaded with resource id: " + keySession.ResourceId);

And in one service, i sometimes get errors about keySession being null in the log line, even for known good keys. But not however in the other. How can i fix that? They shouldn’t really be null.


#2

Hi @loke_xstream,
Can you share the error messages that you get?
I’m wondering if this could perhaps be a timeout error, can you describe the cluster you are using? size, number of doc’s in view, RAM, # cores?

Thanks
Martin


#3

Hej Martin

Sure, i’d be happy to. I don’t really get an error message, but if i do if (keySession == null) that will trigger. If i don’t have the if statement, i will get a “Object reference not set to an instance of an object” on the next line where i access keySession.ResourceId.

It is a 2 node cluster running 2.5.1, currently the bucket contains around 23000 elements, and with that view i am returning a single document. Each node has 2 gb of ram allocated and are using less than 10% CPU. So i doubt very much that it is a load issue. Especially since it for some reason only happens on one of the applications.


#4

How many view’s is there in the cluster?


#5

Counted across all data buckets for both production and development?


#6

Yep, all bucket’s in dev and production and then the actual numbers for the bucket in question.


#7

It has two buckets:
default (which of course is default)
keys (which has 3 views: all, by_keyId, by_requestor) Views then have a copy in development in addition to production.
So i guess a total of 6 views.

Also just updated to 2.5.2. from 2.5.1 to eliminate that as an issue.