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

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

From: Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] "could not reattach to shared memory" on Windows
Date: 2009-07-15 09:20:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

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.


Tsutomu Yamada
SRA OSS, Inc. Japan

In response to


pgsql-hackers by date

Next:From: Pavel StehuleDate: 2009-07-15 10:18:54
Subject: slow count in window query
Previous:From: Andrea SuisaniDate: 2009-07-15 07:50:03
Subject: Re: Mysql.whynot or PG vs MySQL comparison table?

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