Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] "could not reattach to shared memory" on Windows

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] "could not reattach to shared memory" on Windows
Date: 2009-07-21 12:06:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Wed, Jul 15, 2009 at 11:20, Tsutomu Yamada<tsutomu(at)sraoss(dot)co(dot)jp> wrote:
> Hello,
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
>  > Tsutomu Yamada wrote:
>  >
>  > > This patch using VirtualAlloc()/VirtualFree() to avoid failing in
>  > > reattach to shared memory.
>  > >
>  > > Can this be added to CommitFest ?
>  >
>  > Since this fixes a very annoying bug present in older versions, I think
>  > this should be backpatched all the way back to 8.2.
>  >
>  > Some notes about the patch itself:
>  >
>  > - please use ereport() instead of elog() for error messages
>  > - Are you really putting the pgwin32_ReserveSharedMemory declaration
>  > inside a function?  Please move that into the appropriate header file.
>  > - Failure to reserve memory in pgwin32_ReserveSharedMemory should be a
>  > FATAL error I think, not simply LOG.
> In this case,
> the parent process operates child's memory by using VirtualAlloc().
> If VirtualAlloc failed and be a FATAL error, master process will be stopped.
> I think that is not preferable.
> So, when VirtualAlloc failed, parent reports error and terminates child.
> Revised patch
> - move function declaration to include/port/win32.h
> - add error check.
>  when VirtualAlloc failed, parent will terminate child process.

This patch looks a lot like one I've had sitting in my tree since
before I left for three weeks of vacation, based on the same
suggestion on the list. I will check if we have any actual functional
differences, and merge yours with mine. The one I had worked fine in
my testing.

Once that is done, I propose the following:

* Apply to HEAD. That will give us buildfarm coverage.
* Produce a modified 8.4.0 *and* 8.3.7 binary for this, and ask people
to test this. Both people with and without the problem.
* Assuming it works for all users, backpatch to 8.2, 8.3 and 8.4.

 Magnus Hagander

In response to


pgsql-hackers by date

Next:From: Dickson S. GuedesDate: 2009-07-21 12:23:25
Subject: Re: Duplicate key value error
Previous:From: Greg StarkDate: 2009-07-21 12:06:17
Subject: Re: [PATCH] SE-PgSQL/tiny rev.2193

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group