[NCBC-210] .NET Client is throwing NullReferenceExceptions (CBSE-341) Created: 25/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

Status: Closed
Project: Couchbase .NET client library
Component/s: library
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Saakshi Manocha Assignee: Saakshi Manocha
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File CouchbaseClientNullReferenceCrash.rar    

Issue is raised by a customer in ticket CBSE-341 (http://www.couchbase.com/issues/browse/CBSE-341), the details are mentioned in the ticket itself.

Following are the observations related to the issue:

--> when we create a client with bucket which doesn't exist, the error message should be more appropriate like "Bucket does not exist" and the code should simply exit with a false status. Currently it throws an exception and the error message that comes is "Object reference not set to an instance of an object.".

Error source : Couchbase.CouchbasePool.Enyim.Caching.Memcached.IServerPool.Locate(String key)
                       Couchbase.CouchbaseClient.PerformStore(StoreMode mode, String key, Object value, UInt32 expires, UInt64& cas, Int32& statusCode)
                       Enyim.Caching.MemcachedClient.Store(StoreMode mode, String key, Object value)
May be we need to add some condition that checks whether node (returned from Locate()) in null or not. If null, it should not proceed further to perform store operation. It should return apt message and simply exit with false status.

--> Rebalance operation takes quite some time. During this operation, the server nodes may become unavailable for sometime or even get removed from the cluster and hence the bucket is also not available. Exception is thrown "Object reference not set to an instance of an object)". Error source same as above : Couchbase.CouchbasePool.Enyim.Caching.Memcached.IServerPool.Locate(String key)

--> Refer to the attached sample code, I used my cluster which has following server nodes:
In the code Program.cs, use the bucket name that does not exist, the code will throw the exception.
Next use the correct bucket name but manually fail over a node & start rebalance. It will throw the exception.

Comment by Saakshi Manocha [ 25/Jan/13 ]
sample code to reproduce issue
Comment by John Zablocki (Inactive) [ 30/Jan/13 ]
Generated at Tue Oct 21 09:11:32 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.