-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
- What versions are you using?
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
> process.platform
'darwin'
> process.version
'v14.15.0'
> process.arch
'x64'
> require('oracledb').versionString
'5.0.0'
> require('oracledb').oracleClientVersionString
'12.1.0.2.0'- Is it an error or a hang or a crash?
crash I believe, but it causes my application to hang based on implementation
- What error(s) or behavior you are seeing?
The sql hangs/crashes when using queryStream if there's a logical error in the select/result set, but only if the error occurs after the first row. This does not occur when using execute.
- Include a runnable Node.js script that shows the problem.
const oracledb = require('oracledb');
const fs = require('fs');
const path = require('path');
const { Transform, pipeline } = require('stream');
// oracledb.initOracleClient({ libDir: '/usr/local/oracle/instantclient_19_3' });
let pool;
let conn;
const sql = 'select 1 from dual union all select 1 from dual union all select 1/0 from dual';
(async () => {
try {
pool = await oracledb.createPool({
user: '',
password: '',
connectString: '',
});
conn = await pool.getConnection();
const queryStream = conn.queryStream(sql, {}, { outFormat: oracledb.OUT_FORMAT_OBJECT });
queryStream.on('error', console.error);
queryStream.on('close', () => {
console.log('queryStream CLOSED!');
await conn.close();
await pool.close(10);
});
// create other streams
const transformStream = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
console.log(chunk);
return callback(null, JSON.stringify(chunk, null, 2));
},
});
const writeStream = fs.createWriteStream(path.join(__dirname, 'output.json'));
writeStream.on('finish', () => {
console.log('DONE!');
});
// run the stream
pipeline(queryStream, transformStream, writeStream, (err) => {
if (err) console.error(err);
});
} catch (err) {
console.error(err);
}
})();