Couchbase 2.0 / node.js crash on Mac OS X Mountain Lion
Tue, 02/12/2013 - 02:40
Hello
I am using Couchbase server version 2.0.0-1976-rel, with node.js (v0.8.19), couchbase module (0.0.11) and libcouchbase (2.0.3). On a Mac with OS X Mountain Lion 10.8.2, the code below crashes the whole node process.
node(3053,0x7fff75619180) malloc: *** error for object 0x102013292: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
I compiled node with debug and used gdb to backtrace
Program received signal SIGABRT, Aborted. 0x00007fff8bbf7212 in __pthread_kill () (gdb) backtrace #0 0x00007fff8bbf7212 in __pthread_kill () #1 0x00007fff8cd6eaf4 in pthread_kill () #2 0x00007fff8cdb2dce in abort () #3 0x00007fff8cd86959 in free () #4 0x0000000101e91c33 in lcb_server_purge_implicit_responses () #5 0x0000000101e89f09 in lcb_server_event_handler () #6 0x0000000101adebab in maybe_callout [inlined] () at :34 #7 0x0000000101adebab in async_cb (handle=<value temporarily unavailable, due to optimizations>, status=0) at ../io/common.c:68 #8 0x00000001000442ea in uv__async_io (loop=<value temporarily unavailable, due to optimizations>, handle=0x1c042a000000000, events=1060378680) at ../deps/uv/src/unix/async.c:117 #9 0x0000000100049c24 in ev_invoke_pending (loop=0x10082bd68) at ../deps/uv/src/unix/ev/ev.c:2145 #10 0x00000001000445e8 in uv__run (loop=0x10082b420) at ../deps/uv/src/unix/core.c:248 #11 0x0000000100044517 in uv_run (loop=0x10082b420) at ../deps/uv/src/unix/core.c:265 #12 0x0000000100008d9b in node::Start (argc=<value temporarily unavailable, due to optimizations>, argv=0x7fff5fbffb98) at ../src/node.cc:2974
The same code works fine on (Amazon hosted) CentOS 6 with the same node.js and libs versions.
Am I doing something wrong?
The code
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": "***", "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); }); }); });
Tue, 02/12/2013 - 10:41
Thanks a ton. Can I get the issue number once you create it, please?
I'd like to watch it
Cheers
Mladen
Tue, 02/12/2013 - 10:55
Sorry I though I've done it:
http://www.couchbase.com/issues/browse/JSCBC-16
Regards
Tue, 02/12/2013 - 14:38
Is there any way I can "watch" the issue and receive notifications, like the real JIRA watch?
Hello,
I was able to reproduce your issue will log some issue in the Node JS Client API
Regards
Tug
@tgrall