Hi list! I was testing a high-availability cluster of postgres databases when I stumbled on a problem: a call to execute blocks and never returns hence making the application hang forever instead of failing.
That was the short story. The long one is as follows: I wrote a script that inserts into a remote postgres database in an infinite loop. The script connects to the remote database over a tcp socket. At some point, I block traffic to the postgres database by setting an iptable reject rule on the database server. At that point, the script freezes. I turned on trace in DBI and saw that the script freezes due to a blocking execute call. I was expecting execute to emit an error when the tcp socket gets closed by the reject iptable rules, but it does not. So I tried with an iptable drop rule, which is just a way of simulating someone plugging out the ethernet cable to the database server, but the reaction was the same: execute blocks forever. Is this a normal behavior for execute? Is there any built-in way to set a timeout on execute, or to force it to detect connection errors at the tcp level? (I could use the eval/alarm trick in the application, but it feels rather unsafe) Thanks by advance! /Erwan Lemonnier
