Parent cluster object has been closed

What is parent cluster object has been closed error exactly?

The my node js application in local machine of couchbase get parent cluster object has been closed error while the same remote note js application works
I stopped firewall to ensure there is no port blocking issue

Hello @socketman2016 , although this error doesn’t give you much information the error itself means that the connection to your cluster is not established due to various many reasons (incorrect username, pwd, bucket name etc).

Why I have parent cluster object has been closed error after a while? When the server starts the operation works after a white (about 10min) operation failed with the error

Hello @socketman2016 probably your concerns are related to this ? Couchbase connection closed intermittently - Node.js SDK - #6 by 00christian00

@brett19 can you also confirm please ?

Yes , I think
How can I fix it?

@socketman2016 from the last paragraph of the last response what @brett19 is recommending is

Note that, to your point, it is possible to infer the status of a connection through the Error’s thrown from operations. That is to say that if you perform an operation and receive an error back indicating that the connection is closed but you are certain that the issue is transient, you can simply instantiate a new Cluster object. In the near future this reconnection will no longer be necessary, as the SDK will internally perform the reconnect automatically, and will additionally provide additional context to the error that is throw from the operation, indicating the reason that the connection was lost.

@brett19 any further suggestions / recommendations ?

1 Like

@brett19 Can you please reply?

Hey @socketman2016 ,

It sounds like you are bumping into one of the known issues where the SDK fails to properly indicate the reasoning for connection failures. You can enable debugging using something akin to DEBUG=* node index when starting your application to see the underlying failure that is occurring. Additionally, we are tracking the needed fixes to resolve this under the following issue:
https://issues.couchbase.com/browse/JSCBC-706

Cheers, Brett

@brett19 Do you know when it fixed? As the issue created long time ago

Hey @socketman2016,

We don’t currently have an estimated fix date, although the underlying CCBC fix that we are waiting on is relatively high priority so it should be addressed in the not-to-distant future.

Cheers, Brett

@brett19 What is the error code of parent cluster object has been closed I want to catch error and instantiate a new Cluster object
If any other error exists that need to instantiate a new Cluster object, list it here please

1 Like

@brett19 can you please help me, SDK v3 killed my server, I need to know all error codes that needs to instantiate a new Cluster object to bypass the bug

Hey @socketman2016 ,

The “parent cluster is already closed” error should be the only one that could require recreation of the Cluster object. I do not believe it has an error code associated with it, as it is not created as part of normal SDK operation (it’s intended to be a backup for when an application attempts to use a connection after its been closed).

As an aside, would you be able to tell me a little more about the specific scenario that you are encountering where your application works for a period of time and then stops? Specifically, it would be really helpful to see the debug output from the SDK at the time that the error pops up.

Cheers, Brett

@brett19 it’s happens time to time, without any specific pattern, I know it just happens with SDK v3, not SDK v2

nodejs.Error: parent cluster object has been closed
    at Connection._maybeBFwd (/home/app/core/node_modules/couchbase/lib/connection.js:227:13)
    at Connection.lookupIn (/home/app/core/node_modules/couchbase/lib/connection.js:304:10)
    at /home/app/core/node_modules/couchbase/lib/collection.js:1106:25
    at /home/app/core/node_modules/couchbase/lib/promisehelper.js:30:7
    at new Promise (<anonymous>)
    at Function.wrap (/home/app/core/node_modules/couchbase/lib/promisehelper.js:29:12)
    at Collection.lookupIn (/home/app/core/node_modules/couchbase/lib/collection.js:1099:26)
 nodejs.Error: parent cluster object has been closed
    at Connection._maybeFwd (/home/app/core/node_modules/couchbase/lib/connection.js:202:13)
    at Connection.query (/home/app/core/node_modules/couchbase/lib/connection.js:316:10)
    at QueryExecutor.query (/home/app/core/node_modules/couchbase/lib/queryexecutor.js:119:16)
    at Cluster.query (/home/app/core/node_modules/couchbase/lib/cluster.js:350:24)

@brett19 as you told “I do not believe it has an error code associated with it” , So In catch I must check if(e.message==='parent cluster is already closed"') ?

Hey @socketman2016,

That is correct. Additionally, the debug output I was looking for was that which is output when you set the DEBUG environment variable to include the libcouchbase debug logging, this would help directly identify the reason that you are encountering the cluster closing after you’ve successfully performed operations, which is not expected.

Cheers, Brett

1 Like

I’m not able to provide output with DEBUG environment variable, because the error happens without pattern

@brett19 Why the error in not instance of Couchbase.CouchbaseError?

1 Like

@brett19 Why the error in not instance of Couchbase.CouchbaseError ?

I’m also curious about it. That made it difficult to catch the error, I had to make a comparison directly with the message string to properly detect the error

Hi @brett19/@AV25242 ,

Most of the developers facing issue as cluster object has been closed, i can see reason for you said due to various many reasons (incorrect username, pwd, bucket name etc).

If anything wrong on connection side, please provide valid error message, like invalid username/pwd, cannot find bucket…etc. Then it should be helpful for exception / debug handling.

Thanks