Thread: server shutting down
I've been having a problem for a while and I don't really have any leads to investigate. I've got an Enhydra java web application connected to a PostgreSQL database (this happened with version 7.1.3 as well as 7.2). After a time of running, usually no more than a week, the database stops accepting new connections and responds with a message that it's shutting down. I've checked sys logs, database logs, and application logs but there is no trace of an error. In the mean time the application continues to run, I presume because the application's database manager maintains the original connections. When I have to restart the application, the connections are released and the database dies. Does this sound familiar to anyone? -- Jeremy
Jeremy, One place to start is to look in the postgres server logs and find out why it is shutting down. Also why would the backend stop giving connections? Are you not closing connections? Dave > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jeremy > Sent: Monday, March 25, 2002 11:41 PM > To: pgsql-jdbc@postgresql.org > Subject: [JDBC] server shutting down > > > I've been having a problem for a while and I don't really > have any leads to > investigate. I've got an Enhydra java web application connected to a > PostgreSQL database (this happened with version 7.1.3 as well > as 7.2). After > a time of running, usually no more than a week, the database > stops accepting > new connections and responds with a message that it's > shutting down. I've > checked sys logs, database logs, and application logs but > there is no trace > of an error. In the mean time the application continues to > run, I presume > because the application's database manager maintains the original > connections. When I have to restart the application, the > connections are > released and the database dies. Does this sound familiar to anyone? > -- > Jeremy > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an > appropriate subscribe-nomail command to > majordomo@postgresql.org so that your message can get through > to the mailing list cleanly > >
I had this happen (backend responding with maximum connections reached) just the other day after stopping and starting aserver process I'm developing (stopped/started many times over the day). It seemed the JDBC connections weren't gettingclosed when the Java process was shutdown (CTRL-C or close the console window, not clean I know). After putting in a (JDK1.3 or greater) shutdown hook that explicitly shuts down the (poolman) connection pool, the problemgoes away (looked for instances where I hadn't called close() on the connection too but it was all OK). The only reasonI mention it is because I hadn't seen this before, but that could just be my dev server's lowly specs and 16 configuredmax connections. I guess that the client side sockets are closed, but the backend connections don't realise it?Or maybe its just the timing and they take a little while to realise the client has closed the socket (?). Joe > Jeremy, > > One place to start is to look in the postgres server logs and find out > why it is shutting down. > Also why would the backend stop giving connections? Are you not closing > connections? > > Dave > > > -----Original Message----- > > From: pgsql-jdbc-owner@postgresql.org > > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jeremy > > Sent: Monday, March 25, 2002 11:41 PM > > To: pgsql-jdbc@postgresql.org > > Subject: [JDBC] server shutting down > > > > > > I've been having a problem for a while and I don't really > > have any leads to > > investigate. I've got an Enhydra java web application connected to a > > PostgreSQL database (this happened with version 7.1.3 as well > > as 7.2). After > > a time of running, usually no more than a week, the database > > stops accepting > > new connections and responds with a message that it's > > shutting down. I've > > checked sys logs, database logs, and application logs but > > there is no trace > > of an error. In the mean time the application continues to > > run, I presume > > because the application's database manager maintains the original > > connections. When I have to restart the application, the > > connections are > > released and the database dies. Does this sound familiar to anyone? > > -- > > Jeremy
I think we've found it. I checked the pgsql.log file again and found a few FATAL messages. There were however no indications of a problem but I noticed that the times on these messages were around 6:25 every day. From there I figured it had to be something cron was doing. It's the log rotation. When it rotates the log file, it has to restart the server so it can write to a fresh log file. The server is not shutting down because the application database manager is holding the connections so the database continues to log to the old log file even though it's name has been changed by cron. When the application is stopped, the database manager releases the connections and the database stops. Solution: In the cron job we didn't specify a mode for the stop command and it defaults to "smart" mode which means that it will wait for all connections to exit before it shuts down. We added the -mf flags (fast shutdown mode) to have it disconnect existing connections and then restart. Thanks for the help! On Tuesday 26 March 2002 03:03 pm, you wrote: > I had this happen (backend responding with maximum connections reached) > just the other day after stopping and starting a server process I'm > developing (stopped/started many times over the day). It seemed the JDBC > connections weren't getting closed when the Java process was shutdown > (CTRL-C or close the console window, not clean I know). > > After putting in a (JDK1.3 or greater) shutdown hook that explicitly shuts > down the (poolman) connection pool, the problem goes away (looked for > instances where I hadn't called close() on the connection too but it was > all OK). The only reason I mention it is because I hadn't seen this before, > but that could just be my dev server's lowly specs and 16 configured max > connections. I guess that the client side sockets are closed, but the > backend connections don't realise it? Or maybe its just the timing and they > take a little while to realise the client has closed the socket (?). > > Joe > > > Jeremy, > > > > One place to start is to look in the postgres server logs and find out > > why it is shutting down. > > Also why would the backend stop giving connections? Are you not closing > > connections? > > > > Dave > > > > > -----Original Message----- > > > From: pgsql-jdbc-owner@postgresql.org > > > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jeremy > > > Sent: Monday, March 25, 2002 11:41 PM > > > To: pgsql-jdbc@postgresql.org > > > Subject: [JDBC] server shutting down > > > > > > > > > I've been having a problem for a while and I don't really > > > have any leads to > > > investigate. I've got an Enhydra java web application connected to a > > > PostgreSQL database (this happened with version 7.1.3 as well > > > as 7.2). After > > > a time of running, usually no more than a week, the database > > > stops accepting > > > new connections and responds with a message that it's > > > shutting down. I've > > > checked sys logs, database logs, and application logs but > > > there is no trace > > > of an error. In the mean time the application continues to > > > run, I presume > > > because the application's database manager maintains the original > > > connections. When I have to restart the application, the > > > connections are > > > released and the database dies. Does this sound familiar to anyone? > > > -- > > > Jeremy > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Jeremy Ferry jferry@iexposure.com Internet Exposure Inc. http://www.iexposure.com (612) 676-1946 (ext 18) Web Development - Web Marketing - ISP Services