Re: FATAL: could not reattach to shared memory (Win32)

From: "Trevor Talbot" <quension(at)gmail(dot)com>
To: "Magnus Hagander" <magnus(at)hagander(dot)net>
Cc: "Shelby Cain" <alyandon(at)yahoo(dot)com>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Terry Yapt" <yapt(at)technovell(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: FATAL: could not reattach to shared memory (Win32)
Date: 2007-08-24 12:49:43
Message-ID: 90bce5730708240549y6b42c8a1u4bda5a1892a20e3a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/23/07, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> Shelby Cain wrote:

> > Wild guess on my part... could that error be the result of an attempt
> > to map shared memory into a process at a fixed location that just
> > happens to already be occupied by a dll that Windows had decided to
> > relocate?
>
> Not that wild a guess, really :-) I'd say it's a very good possibility -
> but I have no idea why it'd do that, since all backends load the same
> DLLs at that stage.

Not a valid assumption; you can't rely on consistent VM space among
multiple [non-cloned] processes without a serious amount of effort.
Anything can use that space, it's not just file views. Obviously it
happens to work some of the time, but when it doesn't, it doesn't. I
gather postgres depends on it being at the same address, and fixing
that isn't trivial?

If everything relevant is going through the intriguing
internal_forkexec(), you could probably reserve address space there
before resuming the thread. You'd want to combine this with picking
address space that's less likely to be used before creating the shared
memory section. (Actually, if you're doing that, you might as well
just inject the backend variables too instead of going through the
mapped file gymnastics.)

Not a simple change, but would likely make this particular problem go
away (assuming this is the problem). It's also the first time I've
looked at the source, so perhaps I missed something.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hannes Dorbath 2007-08-24 12:50:57 Re: Apache + PHP + Postgres Interaction
Previous Message Lange Marcus 2007-08-24 12:42:58 Re: Local authentication/security