Skip to content

Connection pool broken in Node 0.5.6? #49

@chowey

Description

@chowey

This problem only came up with Node 0.5.6. I send a request to a postgresql database, wait a minute, and then send another request. It breaks.

Try the following code:

var pg = require('pg'),
    util = require('util');
var connectstring = 'pg://postgres:1234@127.0.0.1/postgres';

function getTheTime() {
  pg.connect(connectstring, function (err, client) {
    client.query('SELECT now() as when', function (err, result) {
      util.log('The postres time is: ' + result.rows[0].when);
    });
  });
}

getTheTime();
setTimeout(getTheTime, 60 * 1000);

The first getTheTime works fine, and the second getTheTime throws the following error:

node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: read UNKNOWN
    at errnoException (net_uv.js:557:11)
    at TCP.onread (net_uv.js:326:20)

I am running Node 0.5.6 on Windows. It only happens with a delay between the two requests. Sending requests repeatedly works fine. Therefore, some new feature in Node 0.5.6 must be dropping the connection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions