Fwd: Re: PostgreSQL 7.3.2 running as NT service under Windows XP

Поиск
Список
Период
Сортировка
От Jason Tishler
Тема Fwd: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Дата
Msg-id 20030524005435.GH956@tishler.net
обсуждение исходный текст
Список pgsql-cygwin
I am forwarding the attached at Frank Seesink's request.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
Jason,

    Apologies in advance for sending this to you "off-list", but for some jackass reason the mail delivery system keeps
barfingup the following message: 
______________________________________________________________________
SUBJECT: Mail delivery failed: returning message to sender

This message was created automatically by mail delivery software (Exim).

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  pgsql-cygwin@postgresql.org
    SMTP error from remote mailer after RCPT TO:<pgsql-cygwin@postgresql.org>:
    host jupiter.hub.org [64.117.225.130]: 550 5.7.1 <pgsql-cygwin@postgresql.org>... Relaying denied
______________________________________________________________________

    No clue why.  I've tried twice already, but no go.  Could you please forward this to the list proper 'til things
settleout?  Nothing has changed on my end, so not sure what's going on.  Seems somebody has changed a mail
configurationsomewhere (jupiter.hub.org means nothing to me, but it's the one that appears to think there's relaying
goingon???), and for some reason my posts--which I did and have always done using Mozilla v1.3's Mail & News
program--arebouncing. 

    My original message follows.
______________________________________________________________________


Jason Tishler wrote:
> Frank,
>
> On Thu, May 22, 2003 at 04:44:30PM -0400, Frank Seesink wrote:
>
>>I'm noticing that my suggestion in the writeup I did--regarding
>>deleting the postmaster.pid file on startup--isn't working properly
>>all the time.  Took some investigating, but basically what I'm finding
>>is that sometimes, after a Windows shutdown/start or restart, for
>>reasons I'm not 100% clear on, the file
>>
>>    /usr/share/postgresql/data/postmaster.pid
>>
>>is left behind.
>
>
> Just a WAG, but does this happen when there are active connections to
> the database?

    Ooh, good question.  Not sure.  But I know it happens even when there
aren't, as I was working with a test config on one PC (my laptop) and
didn't have any connections open that I was aware of.  I may have used
'psql' to see if I could get, but I assume the connection closes once I
get out of that.

> Anyway, did you supply the following options to cygrunsrv when you
> installed postmaster as a service:
>
>     1. --termsig INT
>     2. --shutdown
>
> Note that cygrunsrv defaults to TERM which will cause postmaster to wait
> for all connections to end before terminating.

    I literally copy/pasted the command from your README file:

cygrunsrv --install postmaster --path /usr/bin/postmaster --args "-D
/usr/share/postgresql/data -i" --dep ipc-daemon --termsig INT --user
postgres --shutdown

whenever doing installs.  Saved me time, and avoided many of the issues
I see caused by typos. :-)

> FWIW, the above cygrunsrv options have guaranteed me clean shutdowns
> under 2000.

    Wish I could say the same.

>>And just as important, does this indicate that PostgreSQL is not being
>>given the time it needs to clean house prior to reboot?
>
>
> Most likely yes.

    Now the big $64K question:  Why? :-)

>>I've spent the better part of my time trying to find a nice, clean,
>>simple way to delete a file on Windows startup (but prior to NT
>>services kicking in), and I'll be darned...it's a lot more difficult
>>than I would have imagined.
>
>
> Why not wrap postmaster in a shell script, /usr/local/bin/postmaster.sh?
>
>     #!/bin/sh
>     rm -f /usr/share/postgresql/data/postmaster.pid
>     /usr/bin/postmaster $*
>
> And then install postmaster.sh as the "service".

    Uh...I think this would fall under the category of "BAD Idea", wouldn't
it?  I mean, the whole point of postmaster.pid is to prevent MULTIPLE
copies of postmaster from firing up against the same data set.  All I
want to do is make sure no such file exists on startup, and ONLY on
startup.  The above defeats the purpose by deleting it regardless.

    I see your point, though.  As long as no one inadvertently runs the
/usr/local/bin/postmaster.sh script (possibly place it someplace OUTSIDE
the PATH to make it more difficult to do 'accidentally'), you're ok.
But as I would in any normal *nix environment, I was just trying
administratively to do "the right thing" in Windows as opposed to the
quick-and-dirty.  But unlike *nix, Windows does not seem to offer that
easily.

>>[snip]
>>
>>Is cygrunsrv replying to the Windows kill signal before postmaster
>>has fully shutdown?  I honestly don't know.
>
>
> I don't know either.
>
>
>>I know that if I manually do a 'net start postmaster' and 'net stop
>>postmaster', PostgreSQL properly creates and deletes the
>>postmaster.pid file without incident.
>
>
> The above is another indication that maybe your cygrunsrv shutdown
> parameter are not correct.

    See above.

>>What does it indicate if I do a simple Windows restart when the
>>postmaster.pid file is still there on reboot?
>
>
> Sorry, I can't parse the above -- even after multiple readings.

    Basically, repeating the point that the postmaster.pid exists after a
Windows restart, but it is properly deleted when using manual commands.
  So what does that (the existence of the file on restart) imply?

>>And how can I be sure PostgreSQL has properly shutdown (other than
>>checking /var/log/postmaster.log...which doesn't timestamp all its
>>messages)?
>
>
> I can only recommend checking the log file.  Even without the
> timestamps, you should be able to figure out if PostgreSQL shut and
> started up cleanly.  You can always start with a fresh log file to
> facilitate the analysis.

    I've done that.  Still not much use.  PostgreSQL isn't very verbose in
its logging.  But that's fine.  So far, all seems to work.  I did dig up
that, by default, Win2K and WinXP are configured to wait 20 seconds
after a kill signal has been sent to an app/service before giving that
popup dialog where you can choose to end the process.  20 seconds should
be plenty of time, as when I use 'net stop postmaster' it rarely takes
more than 5 seconds.  But it is possible (though I don't have the Reg
key handy) to change that default, so users requiring more time for a
service like 'postmaster' to die have that option as well.

    Anyway, my hack solution works about as cleanly as I could hope for
under the circumstances.  (Still floors me that MS doesn't offer admins
easy ways to add scripting to various stages of the startup/shutdown
processes, but whatever.)  My biggest concern was whether PostgreSQL was
having its legs ripped out from under itself by Windows and what risks
that imposed.  I posted more for the sake of anyone else who might come
along in the future with similar questions.  It's not elegant, but it
works.  And the postmaster.sh script idea would be another approach to take.



В списке pgsql-cygwin по дате отправления:

Предыдущее
От: Jason Tishler
Дата:
Сообщение: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Следующее
От: s0lao@netscape.net (S. L.)
Дата:
Сообщение: Re: PostgreSQL 7.3.2 running as NT service under Windows XP not always