Closed soyuka closed 9 years ago
I get segfaults too on node v0.10.33 on Mac OS X Yosemite.
PID 94131 received SIGSEGV for address: 0x48 0 segfault-handler.node 0x00000001008d647f _ZL16segfault_handleriP9siginfoPv + 287 1 libsystem_platform.dylib 0x00007fff90d27f1a _sigtramp + 26 2 ??? 0x0000000000000000 0x0 + 0 3 libclntsh.dylib.11.1 0x0000000104a0412e kpufcpf + 8590 4 libclntsh.dylib.11.1 0x0000000104a0584c kpufch0 + 5052 5 libclntsh.dylib.11.1 0x0000000104a098c5 kpufch + 8757 6 libclntsh.dylib.11.1 0x0000000104bf0970 OCIStmtFetch + 96 7 libocci.dylib.11.1 0x00000001040443a3 _ZN6oracle4occi13ResultSetImpl4nextEj + 1497 8 oracle_bindings.node 0x00000001008e9389 _ZN6Reader12EIO_NextRowsEP9uv_work_s + 359 9 node 0x0000000100391757 worker + 90 10 node 0x0000000100387f32 uvthread_start + 25 11 libsystem_pthread.dylib 0x00007fff901d92fc _pthread_body + 131 12 libsystem_pthread.dylib 0x00007fff901d9279 _pthread_body + 0 13 libsystem_pthread.dylib 0x00007fff901d74b1 thread_start + 13
Thank you for reporting the issue. I'll investigate.
Do you use reader.nextRows(count, callback) with a big count? or just reader.nextRow()?
Thanks! Just reader.nextRow(). Here is my test case. FWIW, the database I connect to is on a remote box and rather slow (10 rows take maybe 0.3 second to retrieve). My program consistently segfaults after around 524 rows. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
npm install express, segfault-handler, strong-oracle
app.js:
var SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler();
var fs = require('fs');
var http = require('http');
var db = {
hostname: 'localhost',
port: 1521,
user: 'a',
password: 'b',
database: 'c',
}
var oracle = require('strong-oracle')();
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/public'));
oracle.connect(db, function(err, connection) {
console.log(connection);
app.get('/users', function(req, res) {
res.setHeader("Content-Type", "application/json");
var reader = connection.reader(
"select * from(SELECT * FROM USERS ORDER BY USERNAME) ", []
);
res.write("[");
var first = true;
var doRead = function(cb) {
reader.nextRow(function(err, row) {
if (err) return cb(err);
if (row) {
if (!first)
res.write(",")
res.write(JSON.stringify(row));
first = false;
return doRead(cb)
} else {
res.write("]");
res.end();
return cb();
}
});
}
doRead(function(err) {
if (err) throw err; // or log it
console.log("all records processed");
});
});
app.listen(3000);
});
Same here, I was using just reader.nextRow()
to minimize memory footprint.
Basically doing exactly like @llambda !
By the way, if I use "oracle" module instead of "strong-oracle", I don't get segfault.
Fixed in strong-oracle@1.2.2.
Using the Reader as stated in node-oracle README with more than 10000 lines throws a segmentation fault with node 0.11.13.
I tried to debug it with https://github.com/ddopson/node-segfault-handler but it's not 0.11.13 gyp compatible. You may have suggestions on this?
I've managed to reproduce on 0.10.31: