Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-837

SDK nodejs 3.1.1 - cluster closed OR program not ending OR program stopping with no reason

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Critical
    • None
    • 3.1.1
    • lcb, library
    • None
    • Windows 10 x64 updated
      NODE / NPM 15.6.0
      SDK Nodejs 3.1.1
      Community Server 7.0.0 beta
    • Impediment
    • 1
    • Critical

    Description

      With a testing code (below), i got various results, but NEVER the expected one (run in normal or admin mode):

      • cluster closed with no reason
      • programme did not end and i had to stop node/npm manually
      • programme stopped and no reason given

      Here is the code:

      /*****************************************************************************
       		import & def
      *****************************************************************************/
       
      import couchbase from'couchbase'
      import nconf from 'nconf'
       
       
      import {files} from '../util/export.js'
       
      const SFP = function(p){return p.then(d=>[null,d],e=>[e])}
       
      nconf
      	.argv()
      	.file(files.setPathFor(`./configs/${nconf.get('env')||'dev'}.config.json`))
      	.required(['config','config:db','config:logger'])
       
       
      function dbConfig(params){
      	var {
      		protocol,
      		user,
      		password,
      		url,
      		port,
      		cluster,
      	} = params
       
      	return {
      		url:new URL(`${protocol}://${url}`).toString(),
      		opt:{
      			username:user,
      			password,
      			// logFunc:(...a)=>console.log(JSON.stringify(a))
      		}
      	}
      }
       
      const db = dbConfig(nconf.get('config:db'))
      var connectOpt = [db.url,db.opt]
       
      const opTIMEOUT = {timeout:10} //s
       
       
      // connect for cluster manager
      var cluster = await couchbase.connect(...connectOpt)
      var clustermanager = cluster.buckets()
       
      var bucketOpt = {
      //	name:'testing',
      // 	bucketType:base or ephermeal,
      	ramQuotaMB:100, // 
      	replicaNumber:0,
      	ConflictResolutionType:"seqno"
      	// flushEnabled:false,
      	// managementTimeout:1,
      	// kvTimeout:1,
      }
       
      /*****************************************************************************
       		process function
      *****************************************************************************/
       
      async function process(bucketSettings){
      	var [err,res] = await SFP(clustermanager.createBucket(bucketSettings))
      	console.log('createBucket 1 - expected:undefined,true - result:',bucketSettings.name,err?.message,res)
      	// expected err=null, res = true
       
      	var [err,res] = await SFP(clustermanager.createBucket(bucketSettings))
      	console.log('createBucket 2 - expected:error exists,undefined - result:',bucketSettings.name,err?.message,res)
      	// expected err=null, res = bucket exists
       
      	var bucket = cluster.bucket(bucketSettings.name)
       
      	var collectionOpt = {
      		name:'collecTest',
      		scopeName:'scopeTest',
      		maxExpiry:120
      	}
       
      	var manager = bucket.collections()
      	var [err,scopeRes] = await SFP(manager.createScope(collectionOpt.scopeName,opTIMEOUT))
      	console.log('createScope 1 - expected:undefined,true - result:', err?.message,scopeRes)
      	var [err,scopeRes] = await SFP(manager.createScope(collectionOpt.scopeName,opTIMEOUT))
      	console.log('createScope 2 - expected:error exists,undefined - result:',err?.message,scopeRes)
       
      	var scope = bucket.scope(collectionOpt.scopeName)
       
      	var [err,collectionRes] = await SFP(manager.createCollection(collectionOpt,opTIMEOUT))
      	console.log('createCollection 1 - expected:undefined,true - result:', err?.message,collectionRes)
      	var [err,collectionRes] = await SFP(manager.createCollection(collectionOpt,opTIMEOUT))
      	console.log('createCollection 2 - expected:error exists,undefined - result:',err?.message,collectionRes)
       
      	var collection = bucket.collection(collectionOpt.scopeName)
      }
       
      /*****************************************************************************
       		run
      *****************************************************************************/
       
      // BASE
      var bucketOptBase = {
      	...bucketOpt,
      	name:'testingBase',
      	bucketType:couchbase.BucketType.Couchbase
      }
      console.log('START',bucketOptBase.name)
      await process(bucketOptBase)
      console.log('DONE',bucketOptBase.name)
       
       
      // EPHEMERAL
      var bucketOptEphermer = {
      	...bucketOpt,
      	name:'testingEphermeral',
      	bucketType:couchbase.BucketType.Ephemeral
      }
      console.log('START',bucketOptEphermer.name)
      await process(bucketOptEphermer)
      console.log('DONE',bucketOptEphermer.name)
      

      here are various results:

      • cluster closed

        START testingBase
        createBucket 1 - expected:undefined,true - result: testingBase undefined true
        createBucket 2 - expected:error exists,undefined - result: testingBase bucket exists undefined
        createScope 1 - expected:undefined,true - result: cluster object was closed undefined
        createScope 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        createCollection 1 - expected:undefined,true - result: parent cluster object has been closed undefined
        createCollection 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        DONE testingBase
        START testingEphermeral
        createBucket 1 - expected:undefined,true - result: testingEphermeral parent cluster object has been closed undefined
        createBucket 2 - expected:error exists,undefined - result: testingEphermeral parent cluster object has been closed undefined
        createScope 1 - expected:undefined,true - result: cluster object was closed undefined
        createScope 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        createCollection 1 - expected:undefined,true - result: parent cluster object has been closed undefined
        createCollection 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        DONE testingEphermeral

      • ┬árunning the code again (buckets are created), had to stop the programme manually

        START testingBase
        createBucket 1 - expected:undefined,true - result: testingBase bucket exists undefined
        createBucket 2 - expected:error exists,undefined - result: testingBase bucket exists undefined
        createScope 1 - expected:undefined,true - result: undefined true
        createScope 2 - expected:error exists,undefined - result: scope exists undefined
        createCollection 1 - expected:undefined,true - result: undefined true
        createCollection 2 - expected:error exists,undefined - result: collection exists undefined
        DONE testingBase
        START testingEphermeral
        createBucket 1 - expected:undefined,true - result: testingEphermeral undefined true
        createBucket 2 - expected:error exists,undefined - result: testingEphermeral bucket exists undefined
        createScope 1 - expected:undefined,true - result: cluster object was closed undefined
        createScope 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        createCollection 1 - expected:undefined,true - result: parent cluster object has been closed undefined
        createCollection 2 - expected:error exists,undefined - result: parent cluster object has been closed undefined
        DONE testingEphermeral
        ^C

      • buckets not existing, programme stopped with no reason

        START testingBase
        createBucket 1 - expected:undefined,true - result: testingBase undefined true
        createBucket 2 - expected:error exists,undefined - result: testingBase bucket exists undefined
        createScope 1 - expected:undefined,true - result: undefined true
        createScope 2 - expected:error exists,undefined - result: scope exists undefined

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              brett19 Brett Lawson
              linqFR linqFR
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty