You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting unnecessary console spam from unsuccessful reconnect attempts that seem to be caused by the rejection on this line.
To cause temporary interruptions I used the following SQL. For the grant/revoke to work, the user which connection is being interrupted must not be a superuser. This is probably not the only way to cause an interruption, it could be also at the network level or by temporarily shutting down the database. Setting retryTimeout to a null value is useful as well.
-- Revoke new connections for non-superusersREVOKE CONNECT ON DATABASE mydatabase FROM public;
-- Terminate currently active connections for a specific non-superuser 'myuser'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND usename ='myuser';
-- Some time later restore ability to reconnectGRANT CONNECT ON DATABASE mydatabase TO public;
I couldn't really understand in which state end is called in relation to the try/catch block where this code is placed, so I am unsure what the supposed fix should be.
Here's what I'm getting in console:
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:14040) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14040) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:14040) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:14040) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:14040) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:14040) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:14040) UnhandledPromiseRejectionWarning: Error: Connection ended.
at Client.<anonymous> (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg-listen\dist\index.js:89:93)
at Object.onceWrapper (events.js:286:20)
at Client.emit (events.js:198:13)
at process.nextTick (C:\Users\Indrek\Desktop\node-indexer\node_modules\pg\lib\client.js:256:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
...repeat...
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Yeah, the code is not exactly a beauty, I have to admit.
Anyhow, I might have a fix for the issue, haven't tested it yet, though.
Basically I just replaced two consecutive await that refer to very tightly coupled promises with one await Promise.all() handling both of them, so the second promise is assigned a rejection handler right away and not just after the first promise succeeded.
I'm getting unnecessary console spam from unsuccessful reconnect attempts that seem to be caused by the rejection on this line.
To cause temporary interruptions I used the following SQL. For the grant/revoke to work, the user which connection is being interrupted must not be a superuser. This is probably not the only way to cause an interruption, it could be also at the network level or by temporarily shutting down the database. Setting
retryTimeout
to a null value is useful as well.I couldn't really understand in which state
end
is called in relation to the try/catch block where this code is placed, so I am unsure what the supposed fix should be.Here's what I'm getting in console:
The text was updated successfully, but these errors were encountered: