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:28:33
Message-ID: 47682.67329.qm@web55414.mail.re4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I apologize for resending this but my editor in combination with Yahoo's web mail interface horribly mangled it...

>----- 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 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cody Pisto 2007-08-24 17:35:53 lc_collate issue
Previous Message Erik Jones 2007-08-24 17:27:50 Re: Out of Memory - 8.2.4