Error in couchnode (pointer being freed was not allocated)

I’ve been using couchnode for a while, I recently had a need to save a new piece of data and am getting some errors, wondering if anyone can help out. I’m using an unaltered version of couchnode library running on standard node setup on a Macbook Pro, have installed all C components properly. The issue exists regardless of what Bucket I store it to.

I’m saving two similar pieces of data, one succeeds every time, the other fails every time. Saving the data via REST API or web console works no problem. I’ve installed Couchbase 2.1 on Mac OSX and have the same issue (upgraded from 2.0). As well, I have the latest version of couchnode from NPM.

I should note that this error causes the entire node.js instance to go down.

The error I’m receiving is:

Uncaught Error: Connect Error node(18672,0x7fff72825960) malloc: *** error for object 0x10183b5bc: pointer being freed was not allocated Uncaught Error: Connect Error *** set a breakpoint in malloc_error_break to debug

The good data is as such:

{
“id”: “org::0_120100”,
“destinations”: [
{
“id”: “f7914f98-d9f6-45f2-9f4d-d97a90e481c1”,
“records”: [
{
“code”: “1201007”,
“intra”: 0.002112,
“inter”: 0.002112,
“undet”: 0.002112,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
}
]
}
]
}

The bad data is similar, just a few more objects in the array:

{
“id”: “org::27_120120”,
“destinations”: [
{
“id”: “7ddb7757-21a7-41d9-a752-e32c65022af4”,
“records”: [
{
“code”: “1201200”,
“intra”: 0.0043992,
“inter”: 0.0043992,
“undet”: 0.0043992,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201201”,
“intra”: 0.0276924,
“inter”: 0.0233844,
“undet”: 0.0276924,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201202”,
“intra”: 0.0022644,
“inter”: 0.0033384,
“undet”: 0.0022644,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201203”,
“intra”: 0.003306,
“inter”: 0.004494,
“undet”: 0.003306,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201204”,
“intra”: 0.0038124,
“inter”: 0.005592,
“undet”: 0.0038124,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201205”,
“intra”: 0.0006,
“inter”: 0.00072,
“undet”: 0.0006,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201206”,
“intra”: 0.0006,
“inter”: 0.0006,
“undet”: 0.0006,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201207”,
“intra”: 0.0012,
“inter”: 0.0012,
“undet”: 0.0012,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201208”,
“intra”: 0.00129,
“inter”: 0.00156,
“undet”: 0.00129,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
},
{
“code”: “1201209”,
“intra”: 0.0043992,
“inter”: 0.0043992,
“undet”: 0.0043992,
“dur”: 6,
“incr”: 6,
“rateDeckId”: “xyz”
}
]
}
]
}

Thank you.

Hello,

Which version of Couchnode are you using? As you can see in the repository ( https://github.com/couchbase/couchnode ) the development is more active now on this SDK. Feel free to log bugs when you find some (JIRA is here : http://www.couchbase.com/issues/browse/JSCBC )

Regards
Tug
@tgrall

I was using 0.0.12.

After further investigation, I believe this issue may be associated with having a File stream open at the same time. This issue is only occurring during parsing of a CSV file. I open the file stream and begin reading the rows and saving them to the Couchbase DB. I get the malloc error when saving to Couchbase.