Обсуждение: Is this a time-out issue?
Hello all. I'm running 7.2 on a SuSE 8.0 machine. Overall this is running very well. Except for the following. We have an application running on an RS/6000. It opens a socket to the machine running SuSE. On this SuSE machine is a Java application that reads in data from the socket, parses it, and writes it via JDBC to the database, which is running on the same machine. There are about 100,000 rows a day added to the db. When this is running all seems O.K. However, every once in a while, the data stops being written to the db. 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. Any ideas?
Interesting. Have you confirmed that the socket connection isn't timing out? Because the socket could be closed by the client app. or AIX or SuSE or the server app., due to inactivity. The socket calls and the flags that are passed in those socket calls by the application could be potential causes for socket closure. And then if no activity, then AIX or SuSE may be intervening to force socket closure, which a restart of the application causes it to be active again because of fresh socket calls. Come to think of it...it may not be on the AIX side, since you state that restarting the java app. causes things to be ok again. netstat commands should be useful in monitoring the state of the socket connections. ESTABLISHED or TIME_WAIT states should be watched for perhaps. Not sure if this is helpful or you've already considered these. Otherwise, it could be java app. to jdbc to db. Sanju Nath. Ria International. -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of TimothyReaves@westfieldgrp.com Sent: Thursday, January 30, 2003 12:14 PM To: pgsql-jdbc@postgresql.org Subject: [JDBC] Is this a time-out issue? Hello all. I'm running 7.2 on a SuSE 8.0 machine. Overall this is running very well. Except for the following. We have an application running on an RS/6000. It opens a socket to the machine running SuSE. On this SuSE machine is a Java application that reads in data from the socket, parses it, and writes it via JDBC to the database, which is running on the same machine. There are about 100,000 rows a day added to the db. When this is running all seems O.K. However, every once in a while, the data stops being written to the db. 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. Any ideas? ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 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