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

Node Driver crashes on multi get

    XMLWordPrintable

Details

    • Story
    • Resolution: Fixed
    • Major
    • 0.0.12
    • None
    • library
    • Security Level: Public
    • None
    • OS X Mountain Lion, SDK 0.0.11

    Description

      When you try to execute this code the application crashes:

      var async = require("async");
      var couchBase = require("couchbase");

      var json = {
      "id1":

      { "id": "id1", "name": "Name 1" }

      ,

      "id2":

      { "id": "id2", "name": "Name 2" }

      };

      var config =

      { "host": "localhost", "port": 8091, "username": "Administrator", "password": "password", "bucket": "requests" }

      ;

      couchBase.connect(config, function(err, bucket) {
      if (err)

      { console.log("Unable to connect to Couchbase bucket [" + config.bucket + "]", err); process.exit(1); }

      console.log("Connected to Couchbase");

      var ids = [];
      var jsonDocs = [];
      for (var key in json) {
      if (json.hasOwnProperty(key))

      { var jsonDoc = json[key]; var id = jsonDoc.id; jsonDocs.push(jsonDoc); ids.push(id); }

      }

      bucket.get(ids, null, function(err, docs, metas) {
      if (err) {
      for (var j = 0; j < err.length; j++) {
      if (err[j].code != 13) {
      console.log(

      { err: err }

      , "Unable to get existing entries using multiple get. Error in element [" + j + "]");
      process.exit(1);
      }
      }
      }
      console.log("Checked all docs for existance");

      async.map(jsonDocs, function(doc, callback) {
      bucket.set(doc.id, doc, {}, function(err)

      { callback(err); }

      );
      }, function(err, results) {
      if (err)

      { console.log("Unable to save all entries", err); process.exit(1); }

      console.log("Saved all entries");
      process.exit(0);
      });
      });
      });

      The question comes originally from:
      http://stackoverflow.com/questions/14829946/couchbase-2-0-on-node-js-crashes-when-using-multiple-get
      http://www.couchbase.com/forums/thread/couchbase-2-0-node-js-crash-mac-os-x-mountain-lion

      Attachments

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

        Activity

          People

            tgrall Tug Grall (Inactive)
            tgrall Tug Grall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty