Note that there are some explanatory texts on larger screens.

plurals
  1. POCouchbase Network Error 16, socket assertion failed in node.js
    text
    copied!<p>I have the following node.js script which was running great a couple of days ago but now I get this error:</p> <pre><code>syd@HP-Notebook:~/Desktop$ node db.js connected to database { [Error: Network error] code: 16 } node: ../src/ioplugin.cc:496: virtual int Couchnode::IoOps::updateEvent(lcb_socket_t, void*, short int, void*, void (*)(lcb_socket_t, short int, void*)): Assertion `socket != __null' failed. Aborted (core dumped) </code></pre> <p>and here is the code for db.js:</p> <pre><code>var crypto = require('crypto'); var db = require('couchbase'); var couchBase = null; var committed = 0; var intervalID = null; function strGen(len) { var text = ''; var charset = "abcdefghijklmnopqrstuvwxyz"; for (var i = 0; i &lt; len; i++) { text += charset.charAt(Math.floor(Math.random() * charset.length)); } return text; } function numGen(len) { var text = ''; var charset = "0123456789"; for (var i = 0; i &lt; len; i++) { text += charset.charAt(Math.floor(Math.random() * charset.length)); } return text; } function newLat() { var lat = Math.floor((Math.random() * 2)+1); if (lat == 1) return 37; return 38; } function createDocument() { var name = 'Test user #' + committed; var licensePlates = strGen(3).toUpperCase() +'-'+ numGen(4); var lat = parseFloat(newLat() + '.' + numGen(8)); var lng = parseFloat('23.' + numGen(8)) var timestamp = (new Date()).getTime().toString(); var docKey = crypto.createHash('md5').update(licensePlates + '-' + name).digest('hex'); var docData = { '_id' : docKey, 'name' : name, 'lp' : licensePlates, 'lat' : lat, 'lng' : lng, 'timestamp': timestamp } //console.log(docKey); //console.log(docData); couchBase.set(docKey, JSON.stringify(docData), function(err){ if (err) { console.log(err); } else if (committed &lt; 1000) { committed++; console.log('#'+committed + ' - ' + ' Committed: ' + docKey); } else { clearInterval(intervalID); console.log('I\'m done!'); } }); } db.connect({ 'user':'taxi', 'password':'taxi', 'hosts':['127.0.0.1:8091'], 'bucket':'taxi' }, function(err, cb) { if (err) { console.log('TEST'); console.log(err); } else { couchBase = cb; console.log('connected to database'); intervalID = setInterval(function(){createDocument(null, null, null)}, 5); } }); </code></pre> <p>I didn't have any issues in the past. This occurred after I installed php 5.4 in ubuntu 12.04 and then returned to php 5.3 because I couldnt make couchbase work with that version of php. FYI php &amp; couchbase work just fine at the moment, but not with node. As you can see the connection with the database is established but the set statement fails. Any info would be greatly appreciated. </p> <p><strong>UPDATE</strong></p> <p>Here is the same error from another script:</p> <pre><code>syd@HP-Notebook:~/Desktop$ node test.js Connection established! Function: get Network error Error: Network error at makeError (/home/syd/node_modules/couchbase/lib/bucket.js:578:18) at getParsedHandler (/home/syd/node_modules/couchbase/lib/bucket.js:625:17) node: ../src/ioplugin.cc:496: virtual int Couchnode::IoOps::updateEvent(lcb_socket_t, void*, short int, void*, void (*)(lcb_socket_t, short int, void*)): Assertion `socket != __null' failed. Aborted (core dumped) </code></pre> <p>For further info regarding this script &amp; source please visit: <a href="https://stackoverflow.com/questions/18379115/couchbase-network-error-when-using-get-set-in-bucket-js?noredirect=1#comment26991030_18379115">Couchbase network error when using get &amp; set in bucket.js</a></p> <p>P.S. memcache is working fine with node.js I can get &amp; set. couchnode/couchbase is failing!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload