node-postgres: Error: read ECONNRESET

Hi brianc, this is my first Bug report, so please don’t blame me for bad style:)

I have an issue with loosing connections. This happens after upgrading to node v0.10.1. I used v.8x? before and it worked. I am developing with Windows 8.

Maybe this happens because the Garbage Collector was modified in the new release? I wrote a simple mocha test that shows the problem. var pg = require(‘pg’);

describe('pg', function(){
  this.timeout(65000);
  describe('connection', function() {
    it("should throw no error for 1 min", function(testDone) {

      pg.on("error", function(e){
        //"Error: read ECONNRESET" is thrown for me after 30sec
        testDone(e)
      });

      pg.connect("tcp://postgres:1234@localhost/postgres", function(err, client, done){
        client.query("select 'something'", function(err, result){
          done();
          if (err) return testDone (err);

          setTimeout(function(){
            testDone();
          }, 60000);
        });
      })
    });
  });
})

Debugging this lead me to the assumption, that it is caused by the garbage collector, that is trying to destroy the tcp socket used by the database, but maybe I am completly wrong with this.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I still get this error when trying to connect in Windows 7 x64.

here’s the log:

acquire client begin
dispense() clients=1 available=0 info
createResource() - creating obj - count=1 min=0 max=10 verbose
connecting new client
client connection error: { Error: read ECONNRESET
    at exports._errnoException (util.js:1034:11)
    at TCP.onread (net.js:580:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
acquire client. error: { Error: read ECONNRESET
    at exports._errnoException (util.js:1034:11)
    at TCP.onread (net.js:580:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
pg.connect failed: Error: read ECONNRESET
dispense() clients=0 available=0 info