Re: Is this a time-out issue?
От | Tom Lane |
---|---|
Тема | Re: Is this a time-out issue? |
Дата | |
Msg-id | 450.1043968864@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Is this a time-out issue? ("Sanju Nath" <snath@riainternational.com>) |
Список | pgsql-jdbc |
> What happens is that the client still sends data, but it does not get > written to the db. If I restart the Java app, all is well again. This > seems to happen after extended periods of being idle. Currently the app is > in testing, so goes for days without receiving data. I have been unable to > determine where the breakage is. I think the issue is that the connection > to the db times out, or the socket to the client times out. I bet there's a firewall or NAT translator between the client and server machines? There are no timeouts in the database, nor AFAIK in the JDBC driver. But it's entirely possible, if you send no data for a long time, that something in between might decide the connection is dead. In particular, NAT translation requires the machine doing it to keep track of some state about each connection that's passing through it. I'd expect the translator to drop its state info about a connection that's seen no traffic for a long while. The PG server does configure TCP_KEEPALIVE behavior on its socket, and in an ideal world the server machine's kernel would issue keepalive packets often enough to keep any intervening firewalls from dropping the connection. But I suspect that it's not happening that way for you. If you're really lucky, you can adjust the keepalive delay in the server's kernel, or the connection-drop timeout in the intervening firewall, so that the existing mechanism will solve your problem. If you're not lucky, you may have to put some dummy queries into the client app. regards, tom lane
В списке pgsql-jdbc по дате отправления: