Re: BUG #5628: 9.0beta4 failed automatic crash recovery

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5628: 9.0beta4 failed automatic crash recovery
Date: 2010-08-24 09:08:48
Message-ID: AANLkTi=G7viCEHKFksc9UJyUoJx=Qxz6e25GWv436zC1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Aug 24, 2010 at 11:01 AM, Itagaki Takahiro
<itagaki(dot)takahiro(at)gmail(dot)com> wrote:
> On Tue, Aug 24, 2010 at 5:25 PM, Magnus Hagander <magnus(at)hagander(dot)net>
> wrote:
>>> There might be issues to detach/reattach shared memory on Windows.
>> We've seen this on and off before. Are you saying it's fully reproducible?
>>
>> I don't recall if we did any specific changes around this for 9.0, did we?
>
> Yes, it is reproducible. I tested 8.3 and 8.4, and found 8.3 and newer
> versions failed to recover.
>  * 8.2,17 => OK
>  * 8.3.11, 8.4.4, 9.0b4 => FAILED
>
> Same error messages were logged on failed cases:
>  FATAL:  pre-existing shared memory block is still in use
>  HINT:  Check if there are any old server processes still running,
> and terminate them.

Interesting. It certainly doesn't happen for everybody, or we
would've heard a lot more about this. We have seen a couple of reports
of it, IIRC, but nothing easily reproducible.

Could you try increasing either the Sleep() call or the loop counter
in PGSharedMemoryCreate (win32_shmem.c) to some very high value, and
then when it's trying to restart check:
1) Is there more than one postgres.exe running (there should be only
the postmaster
2) With process explorer, see if postmaster has an open handle to the
shared memory segment (thus is basically conflicting with itself)

> Changes for the issue might be introduced between 8.2 and 8.3,
> or in bugfixes only applied to 8.3 or newer versions.

Yes, the shared memory stuff was basically rewritten for 8.3.

We also have http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=0ad6b8dd7cee13cde693571f20b10b364e52dd23,
which has been backpatched to 8.2 but is not in any yet released
version. Could you try the current tip of the 8.2 branch?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2010-08-24 12:57:34 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Itagaki Takahiro 2010-08-24 09:01:45 Re: BUG #5628: 9.0beta4 failed automatic crash recovery