influent icon indicating copy to clipboard operation
influent copied to clipboard

Quick connections over HTTPS bring down the host

Open dandv opened this issue 9 years ago • 0 comments

I have Influx 1.0.0 running with SSL enabled, with certificates generated by LetsEncrypt.

The following code,

let influent = require('influent');

async function stressTest(client, n) {
  for (let i = 0; i < n; i++) {
    try {
      let r = await client.query(`SELECT value FROM test LIMIT 1 OFFSET ${i}`);
      console.log(i, r.results[0].series[0].values);
    } catch (error) { console.error(error); }
  }
  console.log('Done.');
}

influent.createHttpClient({
  server: 
  // ...
}).then(function (client) {
  stressTest(client, 1000);
}).catch(function (err) {
  console.error(err);
});

Dies after a number of queries with the following error:

$ node_modules/babel-cli/bin/babel-node.js influent.js
0 [ [ '2016-10-05T07:39:43.357Z', 999 ] ]
1 [ [ '2016-10-05T07:39:44.357Z', 998 ] ]
2 [ [ '2016-10-05T07:39:45.357Z', 997 ] ]

{ Error: Request timed out for resource 'https://.../query?q=SELECT%20value%20FROM%20test%20LIMIT%201%20OFFSET%203&db=ticks'
    at Error (native)
    at Child.constructor (/prg/node_modules/hurl/lib/error.js:16:27)
    at new Child (/prg/node_modules/inherits-js/src/inherits.js:13:20)
    at TLSSocket.<anonymous> (/prg/node_modules/hurl/lib/node.js:161:28)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket.Socket._onTimeout (net.js:334:8)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)

The 'test' measurement is a simple {value: 0...999} series with no tags.

I wish I could could make this easier to reproduce, but I haven't found a Docker image with SSL enabled, and before I go to the trouble of creating one, I hope maybe you have Influx running over SSL somewhere to test against.

The same query with cURL succeeds 1000 times:

#!/bin/bash
for i in {1..1000}
do
  echo -n "$i "
  curl 'https://.../query' -u dandv:XXX --data-urlencode 'db=test' --data-urlencode "q=SELECT value FROM series LIMIT 1 OFFSET $i" --silent --show-error -o output.txt
done

dandv avatar Oct 06 '16 08:10 dandv