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 in a situation where my webapp hangs after a firewall drops the connection to the database, established by the adapter, after a certain period of inactivity.
A typical scenario is as follows:
Let's assume that we have a webapp that uses a database located behind a firewall
When the webapp is started, the adapter establishes a connection with the database
When clients connect to the webapp, it uses the adapter to persist/lookup the session into/from the database
Let's assume that there was no activity on the webapp for a period for which the firewall considers that the connection of the webapp to the database is inactive and it drops it
The first time a client with a session id sends a request to the webapp, it will try to lookup the session from the database using the received session id. It will fail with the error below and it will not reply. As such, it will give the impression that it is hanging.
The issue here is due to the fact that the 'pg' module is used to get a one new connection at the beginning and use it as far are the webapp is running.
A solution would be to ask the pg module to use a pool of connections with poolIdleTimeout less than the inactivity period of the firewall. As such, pg module will drop the connection first and recreate it when we ask it to give us a connection (a client).
The error is:
sails-pg-session#set - Error: read ETIMEDOUT
at exports._errnoException (util.js:874:11)
at TCP.onread (net.js:544:26) { [Error: read ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
Error occurred in session middleware :: 'Error: read ETIMEDOUT\n at exports._errnoException (util.js:874:11)\n at TCP.onread (net.js:544:26)'
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
at ServerResponse.res.setHeader (/home/saphir/ws/infra/saphir/ws/node_modules/SaphirNJS.bred.webapp/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:134:22)
at ServerResponse.res.set.res.header (/home/saphir/ws/infra/saphir/ws/node_modules/SaphirNJS.bred.webapp/node_modules/sails/node_modules/express/lib/response.js:595:10)
at ServerResponse.res.send (/home/saphir/ws/infra/saphir/ws/node_modules/SaphirNJS.bred.webapp/node_modules/sails/node_modules/express/lib/response.js:151:12)
at Immediate.<anonymous> (/home/saphir/ws/infra/saphir/ws/node_modules/SaphirNJS.bred.webapp/node_modules/sails/lib/hooks/http/middleware/defaults.js:56:24)
at Immediate.immediate._onImmediate (timers.js:435:18)
at processImmediate [as _immediateCallback] (timers.js:383:17)
The text was updated successfully, but these errors were encountered:
Hi,
I'm in a situation where my webapp hangs after a firewall drops the connection to the database, established by the adapter, after a certain period of inactivity.
A typical scenario is as follows:
The issue here is due to the fact that the 'pg' module is used to get a one new connection at the beginning and use it as far are the webapp is running.
A solution would be to ask the
pg
module to use a pool of connections withpoolIdleTimeout
less than theinactivity period
of the firewall. As such,pg
module will drop the connection first and recreate it when we ask it to give us a connection (a client).The error is:
The text was updated successfully, but these errors were encountered: