From db72f684c91030e277920ad799b86efc58639aae Mon Sep 17 00:00:00 2001 From: Darwin Date: Mon, 7 Mar 2011 12:59:57 +0100 Subject: [PATCH 1/3] added a test that triggers a bug i found, in my project i fixed the bug by making the query smaller (char count). --- .../client/big-simple-query-test.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/integration/client/big-simple-query-test.js diff --git a/test/integration/client/big-simple-query-test.js b/test/integration/client/big-simple-query-test.js new file mode 100644 index 0000000..f9ebf04 --- /dev/null +++ b/test/integration/client/big-simple-query-test.js @@ -0,0 +1,47 @@ +var helper = require(__dirname+"/test-helper"); + +/* + Test to trigger a bug. + + I really dont know what's wrong but it seams that its triggered by multable big queryies with supplied values. + The test bellow can trigger the bug. +*/ + +// Big query with a where clouse from supplied value +var big_query_rows_1 = []; +var big_query_rows_2 = []; +var big_query_rows_3 = []; + +// Works +test('big simple query 1',function() { + var client = helper.client(); + client.query("select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as bla from person where name = '' or 1 = 1") + .on('row', function(row) { big_query_rows_1.push(row); }) + .on('error', function(error) { console.log("big simple query 1 error"); console.log(error); }); + client.on('drain', client.end.bind(client)); +}); + +// Works +test('big simple query 2',function() { + var client = helper.client(); + client.query("select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as bla from person where name = $1 or 1 = 1",['']) + .on('row', function(row) { big_query_rows_2.push(row); }) + .on('error', function(error) { console.log("big simple query 2 error"); console.log(error); }); + client.on('drain', client.end.bind(client)); +}); + +// Fails most of the time with 'invalid byte sequence for encoding "UTF8": 0xb9' or 'insufficient data left in message' +// If test 1 and 2 are commented out it works +test('big simple query 3',function() { + var client = helper.client(); + client.query("select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as bla from person where name = $1 or 1 = 1",['']) + .on('row', function(row) { big_query_rows_3.push(row); }) + .on('error', function(error) { console.log("big simple query 3 error"); console.log(error); }); + client.on('drain', client.end.bind(client)); +}); + +process.on('exit', function() { + assert.equal(big_query_rows_1.length, 26,'big simple query 1 should return 26 rows'); + assert.equal(big_query_rows_2.length, 26,'big simple query 2 should return 26 rows'); + assert.equal(big_query_rows_3.length, 26,'big simple query 3 should return 26 rows'); +}); \ No newline at end of file From 2cecd76dfe7343933e2cd9741f4ca0e0148336b2 Mon Sep 17 00:00:00 2001 From: brianc Date: Mon, 7 Mar 2011 19:00:53 -0600 Subject: [PATCH 2/3] renamed test file to get picked up by automatic test running --- .../{big-simple-query-test.js => big-simple-query-tests.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/integration/client/{big-simple-query-test.js => big-simple-query-tests.js} (100%) diff --git a/test/integration/client/big-simple-query-test.js b/test/integration/client/big-simple-query-tests.js similarity index 100% rename from test/integration/client/big-simple-query-test.js rename to test/integration/client/big-simple-query-tests.js From a205f612ebb897843ad01595f26f146e905467f8 Mon Sep 17 00:00:00 2001 From: brianc Date: Mon, 7 Mar 2011 19:15:27 -0600 Subject: [PATCH 3/3] modified to test larger and more frequent dataset --- .../client/big-simple-query-tests.js | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/test/integration/client/big-simple-query-tests.js b/test/integration/client/big-simple-query-tests.js index f9ebf04..30e2d9d 100644 --- a/test/integration/client/big-simple-query-tests.js +++ b/test/integration/client/big-simple-query-tests.js @@ -2,7 +2,7 @@ var helper = require(__dirname+"/test-helper"); /* Test to trigger a bug. - + I really dont know what's wrong but it seams that its triggered by multable big queryies with supplied values. The test bellow can trigger the bug. */ @@ -33,7 +33,7 @@ test('big simple query 2',function() { // Fails most of the time with 'invalid byte sequence for encoding "UTF8": 0xb9' or 'insufficient data left in message' // If test 1 and 2 are commented out it works test('big simple query 3',function() { - var client = helper.client(); + var client = helper.client(); client.query("select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as bla from person where name = $1 or 1 = 1",['']) .on('row', function(row) { big_query_rows_3.push(row); }) .on('error', function(error) { console.log("big simple query 3 error"); console.log(error); }); @@ -44,4 +44,36 @@ process.on('exit', function() { assert.equal(big_query_rows_1.length, 26,'big simple query 1 should return 26 rows'); assert.equal(big_query_rows_2.length, 26,'big simple query 2 should return 26 rows'); assert.equal(big_query_rows_3.length, 26,'big simple query 3 should return 26 rows'); -}); \ No newline at end of file +}); + + +var runBigQuery = function(client) { + var rows = []; + var q = client.query("select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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1",[''], function(err, result) { + if(err != null) { + console.log(err); + throw Err; + } + assert.length(result.rows, 26); + }); + q.on('row', function(row) { + rows.push(row); + }) + assert.emits(q, 'end', function() { + //query ended + assert.length(rows, 26); + }) +} + +test('many times', function() { + var client = helper.client(); + for(var i = 0; i < 20; i++) { + runBigQuery(client); + } + client.on('drain', function() { + client.end(); + setTimeout(function() { + //let client disconnect fully + }, 100) + }); +})