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

From: Shelby Cain <alyandon(at)yahoo(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Terry Yapt <yapt(at)technovell(dot)com>, Trevor Talbot <quension(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: FATAL: could not reattach to shared memory (Win32)
Date: 2007-08-24 17:08:35
Message-ID: 508147.54198.qm@web55402.mail.re4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>----- Original Message ----
>From: Magnus Hagander <magnus(at)hagander(dot)net>
>To: Shelby Cain <alyandon(at)yahoo(dot)com>
>Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>; Terry Yapt <yapt(at)technovell(dot)com>; pgsql-general(at)postgresql(dot)org
>Sent: Friday, August 24, 2007 1:08:44 AM
>Subject: Re: [GENERAL] FATAL: could not reattach to shared memory (Win32)
>
>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.
>
>//Magnus
>

Assuming this is an issue with shared libraries, I think it would
have more to do with the way Windows resolves address conflicts on process
startup than anything caused by explicit calls to LoadLibrary(). Looking
at postgres.exe with the dependency viewer from
Visual Studio 6, I see that the following shared library dependencies
embedded in the executable image that having conflicting base
addresses. If I'm not mistaken, Windows will automatically relocate
these libraries prior to actual code execution so there would be no
opportunity for that particular instance of postgres.exe to map the shared memory if the address
space is already in use by a relocated dll.

libeay32.dll - 0x10000000

libiconv-2.dll - 0x10000000

libintl-2.dll - 0x10000000

ssleay32.dll - 0x10000000

comerr32.dll - 0x1c000000

krb5_32.dll - 0x1c000000

I also found a KB article that specifically addresses ERROR_INVALID_MEMORY being returned from MapViewOfFileEx().

http://support.microsoft.com/kb/125713

The article specifically addresses the concern where multiple processes
must use
the same address for mappings and how to accomplish that under
Windows. Search for "Addresses of Mapped Views". The only thing that
really gives me any pause is the fact the article hasn't been updated
past the NT 3.51/Windows 9x era but the underlying behavior might not have been changed in Windows 2000/XP/etc.

Regards,

Shelby Cain


____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-08-24 17:12:23 Re: PG Seg Faults Performing a Query
Previous Message Markus Schiltknecht 2007-08-24 16:54:35 Re: Geographic High-Availability/Replication