Intermittent Failures #7

Open
jguerin opened this Issue Jun 8, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

jguerin commented Jun 8, 2012

It appears there may be intermittent failures, and the pattern of doing one query to get results and doing another query using those results seems to make the failures far more frequent. The following code will reproduce the issue (requires a database):

var sql = require('node-sqlserver');
var connectionString = "Driver={SQL Server Native Client 11.0};Server={.\\sqlexpress};Trusted_Connection={Yes};Database=TestDB";

for(var i = 0; i < 10; i++) {
    useSQL(console.log);
}   

function useSQL(callback) {
    sql.query(connectionString, "SELECT TOP 3 [id] FROM [dbo].[blog_posts] WHERE ([showComments] = ?)", [1], function(err, results) {
        var params = [];
        for(var i = 0; i < results.length; i++)
        params.push(results[i].id);

        sql.query(connectionString, "SELECT TOP 10 * FROM [dbo].[blog_comments] WHERE (([postid] = ?) OR ([postid] = ?) OR ([postid] = ?))", params, function(err, results) {
            callback(err, results);
        });
    });
}

jkint was assigned Jun 8, 2012

fkhbgm commented Aug 20, 2012

Just to say that I encoutered that same problem.
I had a deployed test application that just do single select queries in response to url requests.
It worked almost correctly until I cascaded two requests using async like this:
async.series([query1,query2], cb);
This code run query2 in the scope of the callback of query1...
This issue is labeled 'Fix Tested'. When will it be available?
Thank you.

Contributor

jkint commented Aug 21, 2012

The fix for this issue should be coming soon, though I would measure more in days/weeks than hours/days.

jkint was unassigned by jguerin Apr 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment