Possibly unhandled Error: cannot perform operations on a shutdown bucket


#1

Hi,

I’m using express 4.x and I’m trying to do a bucket.counter() operation on an express route. But I’m getting the following error:

Possibly unhandled Error: cannot perform operations on a shutdown bucket

I’m able to connect to the bucket on initialization of my route file with the following commands:

couchbase.Cluster()
cluster.openBucket()

But when my route function gets invoked I get the “unhandled error”.

Any ideas on what I’m doing wrong?

Adrian


#2

Hey agillette,

Could you provide a bit more of your code so we can help you? Unfortunately there are a number of things that could cause this problem. You may also want to check and make sure that your bucket successfully opened (subscribe to the error event on the bucket, example below).

var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
var bucket = cluster.openBucket('default');
bucket.on('error', function(err) {
  console.log('Error connecting to Couchbase Server:', err);
});

Cheers, Brett


#3

Hey @brett19,

Adding the “bucket.on(” helped me pinpoint the problem in my code.

Thanks,

Adrian

BTW - I can’t find the API reference material. Do you know where it is?


#4

Hey agillette,

Check out here!
http://docs.couchbase.com/developer/node-2.0/download-links.html

Cheers, Brett


#5

Hi @brett19,

The links on the page redirects to http://docs.couchbase.com/, which doesn’t have the API references.


#6

Hey @agillette,

Looks like a caching issue. Try this link:
http://docs.couchbase.com/sdk-api/couchbase-node-client-2.0.11/index.html

Cheers, Brett


#7

In continuation to this issue, I understand that one is suppose to use the above solution to capture the thrown shutdown bucket error.
Otherwise the SDK crashes the process of my server (BTW, NEVER EVER NEVER DO THAT - THROW AN ERROR TO A CALLBACK!).

The issue is that I am to pass a function to capture the error and “log” it… but i don’t want to log it, I want to receive it as an error upon the specific operation I did, just like any other error.

Solutions?


#8

Hey @tzali,
In the issue above, the user was opening a bucket connection, but the connection was failing. They were then trying to perform operations, which caused the specific operation to indicate that you cannot perform an operation on a shutdown bucket.

It sounds like your situation may be different than this. If you want to elaborate on your issue, I’d be happy to help.

Cheers, Brett


#9

My issue is exactly as you describe it
Here is some code:

cluster = new couchbase.Cluster('couchbase://'+configuration.couchbase.host+":"+configuration.couchbase.port);
    bucket = cluster.openBucket(configuration.couchbase.schemaBuckets[k]);
    bucket.operationTimeout = configuration.couchbase.timeout || 120 * 1000;

This is what I do when my server uploads - I connect to Couchbase.
Then, when a user does something I execute this:

bucket.get(key, function(err, result) {…});

I expect that if for any reason the bucket is disconnected to receive an error in the err parameter. You SHOULD NOT THROW THE PROCESS _ YOU ARE KILLING THE SERVER THAT USES YOUR SDK!