pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert M. Meyer <rmeyer@installs.com>
To: nickf@ontko.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Leftover processes on shutdown - Debian+JDBC
Date: 13 Aug 2002 12:04:47 -0400
Message-ID: <1029254687.28272.23.camel@skymaster> (raw)
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGOENNFIAA.nickf@ontko.com>
References: <NEBBLAAHGLEEPCGOBHDGOENNFIAA.nickf@ontko.com>

Actually, I'm doing this on RedHat 7.2 but the concept is the same.  If
Debian is using /etc/rc.d/rc?.d/postgresql as it's start and stop
script, then you should be able to modify that directly.  Actually,
Postgres 7.2.1 comes with an example script that I used but I just made
the change to add the '-m immediate' to the thing.

I did this for two reasons.  One, during shutdown, the database would
not be down before the machine rebooted, causing all kinds of
consternation and tomcat would hold up the shutdown of the DB for our
nightly maintenance.

Cheers!

Bob

On Tue, 2002-08-13 at 11:55, Nick Fankhauser wrote:
> Bob-
> 
> Thanks for the suggestion!
> 
> Did you implement this in a Debian Linux environment?
> 
> One of my dillemas is that Debian has a nice (but sometimes limiting)
> utility called "start-stop-daemon" that is used for shutdown in the Debian
> postgresql package, so I think modifying the shutdown script will involve
> more than just adding the "-m immediate" switch in the script.
> 
> On the other hand, it looks like pg_ctl functions in a similar role, so it
> may be possible to just substitute one utility for the other. If you did
> this in Debian, I'd like to know if you were able to make a simple
> substitution.
> 
> If it works well, we should suggest the change to Oliver Elphick for the
> next Debian package release.
> 
> Regards,
> 
> -Nick
> 
> > -----Original Message-----
> > From: Robert M. Meyer [mailto:rmeyer@installs.com]
> > Sent: Tuesday, August 13, 2002 10:26 AM
> > To: nickf@ontko.com
> > Cc: pgsql-jdbc; pgsql-admin
> > Subject: Re: [ADMIN] Leftover processes on shutdown - Debian+JDBC
> >
> >
> > I had the same problem.  I rewrote my shutdown script to call 'pg_ctl -m
> > immediate'.  So far, I haven't seen any damage because of it and we
> > always restart tomcat at some point in the middle of the night, anyway.
> >
> > Hope this helps...
> >
> > Cheers!
> >
> > Bob
> >
> > On Tue, 2002-08-13 at 11:09, Nick Fankhauser wrote:
> > > Hi-
> > >
> > > I've run across a problem that has a simple workaround, but I
> > wonder if it
> > > indicates a problem that needs fixing on the postgresql server end.
> > > Alternately, it may be considered a feature by some...
> > >
> > > My environment is PostgreSQL 7.2.1 on Debian Linux 2.4. On the
> > client side,
> > > I have Tomcat accessing the database using the 7.2 PostgreSQL
> > JDBC Driver.
> > >
> > > The problem is that if I attempt to do a PostgreSQL shutdown
> > while tomcat
> > > still has connections open, the backend processes that have
> > been spawned to
> > > serve tomcat don't go away. This surprises me because they are owned by
> > > postgres & hence it seems as if they should be stopped as well.
> > >
> > > The simple workaround is to make sure that I shutdown tomcat & make the
> > > client connections go away first. This is a sensible procedure
> > anyway, so it
> > > isn't a serious problem.
> > >
> > > Since this involves the start/stop script, I suppose it may be
> > > Debian-specific. It also involves the JDBC driver, but I'm guessing that
> > > this behavior could occur with other client connections.
> > >
> > > I have tried to make the same thing happen by leaving a psql connection
> > > open, but the shutdown is complete in that case, and attempting further
> > > access through the psql client results in an informative error message &
> > > then a connection reset, so in the case of psql, the situation
> > is handled
> > > gracefully.
> > >
> > >
> > > Here is the error message:
> > >
> > > morgai:/data1/postgresql# /etc/init.d/postgresql restart
> > > Restarting PostgreSQL database: postmaster
> > > Stopped /usr/lib/postgresql/bin/postmaster (pid 321 323 324
> > 5465 5466 5470
> > > 5471 5472 5473 5474 5475 5476 5477).
> > > Starting PostgreSQL postmaster.
> > > pg_ctl: Another postmaster may be running.  Trying to start postmaster
> > > anyway.
> > > pg_ctl: cannot start postmaster
> > > Examine the log output.
> > >
> > > -Nick
> > >
> > >
> > --------------------------------------------------------------------------
> > > Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax
> > 1.765.962.9788
> > > Ray Ontko & Co.     Software Consulting Services
> http://www.ontko.com/
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> --
> Robert M. Meyer
> Sr. Network Administrator
> DigiVision Satellite Services
> 14 Lafayette Sq, Ste 410
> Buffalo, NY 14203-1904
> (716)332-1451
> 
-- 
Robert M. Meyer
Sr. Network Administrator
DigiVision Satellite Services
14 Lafayette Sq, Ste 410
Buffalo, NY 14203-1904
(716)332-1451




view thread (17+ messages)  latest in thread

Message-ID: <1029254687.28272.23.camel@skymaster>
Permalink:  ../1029254687.28272.23.camel@skymaster/
Also on:    postgresql.org/message-id/1029254687.28272.23.camel@skymaster

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: rmeyer@installs.com, nickf@ontko.com
  Subject: Re: Leftover processes on shutdown - Debian+JDBC
  In-Reply-To: <1029254687.28272.23.camel@skymaster>
  References: <NEBBLAAHGLEEPCGOBHDGOENNFIAA.nickf@ontko.com> <1029254687.28272.23.camel@skymaster>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox