node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

long-lived connection: internal nodejs exception with ETIMEDOUT at node:internal/stream_base_commons

Open Andrei-Stepanov opened this issue 2 years ago • 5 comments

Hello,

Dear pg mantainer and community.

We are getting random exit from nodejs process with:

Error: read ETIMEDOUT
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Client instance at:
    at Client._handleErrorEvent (/opt/app-root/src/node_modules/pg/lib/client.js:319:10)
    at Connection.emit (node:events:513:28)
    at TLSSocket.reportStreamError (/opt/app-root/src/node_modules/pg/lib/connection.js:52:12)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'read'
}

Node.js v18.9.1
npm timing command:run Completed in 12908487ms
npm timing npm Completed in 12908655ms
npm info ok 

It can happen twice a day or twice for a hour. There is no specific pattern.

I know about: https://node-postgres.com/apis/client#error Please help us understand how to catch this exception and handle it.

Thank you in advance.

Andrei-Stepanov avatar Mar 06 '23 16:03 Andrei-Stepanov

same issue here

jackblanc avatar Nov 29 '23 18:11 jackblanc

I am having the same problem here. Funny enough I only experience these errors on my production database server, but on the other environments (testing and staging). Can this be related to the postgres server configuration somehow?

costa-simulatedreality avatar Feb 05 '24 18:02 costa-simulatedreality

@costa-simulatedreality did you ever end up figuring out what was causing your issue? I'm running into this too and can't reliably reproduce it.

brianmatindi avatar Apr 18 '24 03:04 brianmatindi

@brianmatindi Were you able to figure out what was causing the issue? I am experiencing this in my nestjs project.

symplytheo avatar Jul 12 '24 06:07 symplytheo

I encountered the same issue after my server ran for a couple of hours in the production environment

nDaniel86 avatar Aug 17 '24 14:08 nDaniel86