Couchbase openBucket error handling

Hi, we are facing some issue with couchbase connection issue when handling a large amount of trasaction:

and the reason is , even the connection to http://" + endPoint + "/pools/default/buckets/" + bucket
success

sometimes

myBucket = myCluster.openBucket(bucket);
myBucket.query('query',function(){

});

this method will fail. because myBucket is undefined

To prevent this, I change this method to a callback

myBucket = myCluster.openBucket(bucket);
myBucket.on('connect', function () {

myBucket.query('query',function(){


}).on("error",function(){
//do some thing to reopen the bucket
});
}

can somebody tell me what`s the best solution to reopen the bucket,and continue the query work?

I`m using couchbase v2.1.2

Thank you very much!

The intended model with the client is that it’ll automatically reconnect if there is an issue. So, you shouldn’t need to manually handle this.

You say it’s happening with a large amount of operations, right? Can you characterize that?

Another thing that would help get more info is to turn up the log level with libcouchbase. This is easily done with an environment variable (see the docs). That’ll probably give either you or us a sense of why this is happening.

@brett19 might have some more thoughts too.