msnodesqlv8 bug: Connection is busy with results for another command
See original GitHub issueI have found an issue when executing a stored procedure which raises an error concurrently using the msnodesqlv8 driver. Actually, it happens if the procedure does not exist as well.
I am not sure if it is a bug in mssql or in msnodesqlv8 itself. I report it here as my code is not using msnodesqlv8 directly. The problem is with the versions
mssql: 3.3.0 msnodesqlv8: 0.2.x (I have tried with the latest and many other releases)
However, it works with msnodesqlv8 0.1.46
. So it seems that it was introduced in the 0.2.x
releases.
I have narrowed the problem to the following minimal code:
'use strict';
const sql = require('mssql');
sql.connect({
driver: 'msnodesqlv8',
server: 'localhost',
database: 'master',
options: { trustedConnection: true }
}).then(db=>{
let array = [];
for (let i=0; i<100; i++){
array.push(i);
}
return Promise.all(array.map(i=>{
let request = db.request();
// test should raise an error, or just don't exist at all
return request.execute('test').catch(err=>{
console.log(err);
});
}));
}).then(()=>{
process.exit(0);
}).catch(err=>{
console.log(err);
process.exit(-1);
});
When it works, you expect the errors to be like
{ [RequestError: error]
name: 'RequestError',
message: 'error',
code: 'EREQUEST',
number: 50000,
lineNumber: undefined,
state: '42000',
class: undefined,
serverName: undefined,
procName: undefined }
(or whatever error the procedure throws)
However, with the latest version, I get many instances of the following error:
{ [RequestError: Connection is busy with results for another command]
name: 'RequestError',
message: 'Connection is busy with results for another command',
code: 'EREQUEST',
number: 0,
lineNumber: undefined,
state: 'HY000',
class: undefined,
serverName: undefined,
procName: undefined }
I do not know if this this could affect to concurrent operations to the faulty one that do not raise any errors.
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (8 by maintainers)
That is interesting. I will take a look at this issue to see why 16 does not terminate a statement correctly.
I’ll report back when I know more. Can I reproduce this issue with a raise error 16 statement ?
Sent from my iPhone
@TimelordUK Thanks for your work on msnodesqlv8. I have an old setup where updating to 0.2.16 avoids connection is busy when severity is 14 (ex: constraint issue) as described; however, it there something I can override so that severity 16 issues don’t cause it as well? Any attempted addition over the specified column length (severity 16) causes connection is busy for us. We’re using the loopback framework with msnodesqlv8 as the driver.
Thanks, Kyle