5

In one of our environments we execute quite heavy query from python script using psycopg2. It takes more then 10 min to execute but we get a result and can consume received data.

When we move the same script to different environment then after ~5min we get an error: psycopg2.InterfaceError: connection already closed

What may be the reason for that?

1 Answer 1

4

The most likely reason is you have a firewall or gateway which is not very patient and is dropping the connection after 5 minutes. Usually when this happens, it makes it look to the client like the server closed the connection, and to the server like the client closed the connection. That seems to be compatible with the error message you see in python. What does the server's log file blame the problem on?

1
  • TCP keepalive settings can also cause such problems. Commented Apr 9, 2018 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.