-
I'm unsure if this is an issue, or if I've just not configured it properly. I am having an issue w/ the FROST HTTP container contacting Postgres on the backend. What happens is, after a period of downtime, when a POST is sent, the initial POST doesn't get written to the DB, but subsequent POST's will write just fine. This also happens if POSTing a batch of requests. We are running FROST in docker containers, with the HTTP container behind a proxy (NGINX, in another container) on a server in our DMZ, and the DB on a separate, bare-metal server on our internal network. The firewall between the server running the HTTP container and the DB has a timeout for connections after an hour, which I believe is causing the connection between FROST and the DB to be severed, while FROST still thinks the connection is active. Doing a tcpdump, I can see when this happens that NGINX sends a SYN packet to the HTTP container, but then the HTTP container immediately sends a PSH to the DB using an existing open port as the source, and the DB never responds. Then, once you send another POST, a SYN is properly sent from FROST to the DB on a new source port, and the POST is successful. My question is, how do I configure FROST to reset these connections before our firewall terminates the connection if its inactive? I've been sorting through the documentation, and none of the settings appear to have an impact on the behavior. I tried setting the persistence.queryTimeout to 3600 (seconds), restarted the container, and the behavior was still observed. Additionally, I have tried updating /etc/sysctl.conf within the HTTP container as well as on the localhost to the following: After updating the values (restarted the container, ran sysctl --system on the localhost), the behavior was still observed. Is this an issue with FROST, or is there a configuration option I'm missing? EDIT: I've verified that in the HTTP container, it keeps an existing connection open to the DB, even tho no data is sent. However, tcp keepalive doesn't appear to be doing its job, as the connection remains after an hour has gone by with no activity. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Having an internal firewall between your servers, that kills connections, sounds like a bad idea... |
Beta Was this translation helpful? Give feedback.
Having an internal firewall between your servers, that kills connections, sounds like a bad idea...
You could try the connection option tcpKeepAlive in the PostgreSQL connection string.
Or have a simple client that regularly does a GET on v1.1/Things...