Open DavidRusso opened 2 years ago
:wave: Hi! This issue has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed.
Please keep this active.
@abmusse can you please add keep-open rules to our stale bot config?
Describe the bug Calling a stored procedure with a binary parameter corrupts the Node process. The problem manifests itself in different ways depending on the program. For example, the process may crash with a segmentation fault.
To Reproduce Steps to reproduce the behavior:
const db2i = require("idb-connector"); const util = require("util");
(async () => {
let dbconn; try { dbconn = new db2i.dbconn(); dbconn.conn("*LOCAL"); for (let i = 0; i < 1000; i++) console.log(i, await call()); } catch (error) { console.error(error); } finally { dbconn.disconn(); dbconn.close(); process.exit(0); }
async function call() { let dbstmt = new db2i.dbstmt(dbconn); try { await util.promisify(dbstmt.prepare).bind(dbstmt)("call yourlib.testbin(?,?)"); await util.promisify(dbstmt.bindParam).bind(dbstmt)([ [Buffer.alloc(16), db2i.IN, db2i.BINARY], [null, db2i.OUT, db2i.CHAR] ]); const output = await new Promise((resolve, reject) => { dbstmt.execute((outputParams, error) => { if (error) reject(error); else resolve(outputParams); }); }); return output; } finally { dbstmt.close(); }
}
})();
0 [ '1' ] 1 [ '1' ] 2 [ '1' ] 3 [ '1' ] 4 [ '1' ] 5 [ '1' ] 6 [ '1' ]
#
Fatal error in , line 0
Check failed: result.second.
# # #
FailureMessage Object: fffffffffffe510
Trace/BPT trap (core dumped)