node-oracle
node-oracle copied to clipboard
connection.commit() SegFault
Hi!
All my calls for commit() close node with Segmentation Fault. I tested this with setAutoCommit(false).
I tested with Instant Client 12.1
Example:
var oracle = require("oracle")
var INSERT_EXAMPLE= ... //wherever
oracle.connect(connectData, function(err, connection) {
if (err) { console.log("Error connecting to db:", err); return; }
connection.setAutoCommit(false)
connection.execute(INSERT_EXAMPLE, [], function(err, results) {
if (err) { console.log("Error executing query:", err); return; }
//WILL SEGFAULT HERE!!!
connection.commit(function(err) {
console.log("callback commit")
console.log(err)
});
connection.close(); // call only when query is finished executing
});
});
please put the connection.close() inside
the commit callback. You are probably closing the connection before the commit happens.
Shouldnot result in a SegFault, but might be the cause
ok, was wrong here, but i have segfault yet in commit().
My workaround is replace commit and close functions for:
connection.execute("commit", [], function (err, results) {console.log(err); connection.close();} )
I'm running into this as well, with both commit and rollback on node v0.8.14 and v0.8.21. I've confirmed that doing an execute('commit'...) or execute('rollback', ...) appears to work. I don't close connection at all, since I'm using generic-pool, so it's probably not related to connection.close().