Help us test a patch for the Win32 shared memory issue

We currently have a patch sitting in the queue from Tsutomu Yamada with modifications from me, all based on an idea from Trevor Talbot some time back. (That should do it for credits) It tries to pre-reserve the shared memory region during DLL initialization, and then releases it just in time to reallocate it as shared memory. (that will do for technical detail for now) This should hopefully fix the infamous "failed to re-attach to shared memory" errors we've been seeing on Windows.

We need your help to test it!

We need help both from people who are experiencing the problem - to see if it solves it, and from people who are not experiencing it - to make sure it doesn't cause any new problems.

Dave has built binaries for 8.3.7 and 8.4.0. To test the patch, stop your server, take a backup copy of your postgres.exe file, and replace it with the file from the appropriate ZIP file before. Restart the server, and see if it works!

Once you have tested, please report your success to the pgsql-hackers list, or directly to me and I'll tally it up.

Update: These patched binaries will only work if you installed from the One-click installer. Specifically, they will not work if you installed from the MSI installer due to a mismatch in the configuration option for integer vs floating point datetime handling.


I've "installed" the 8.3.7 patch today and will give you a feedback as soon as possible. greetings from berlin -stefan wolf-

Posted on Jul 27, 2009 at 07:12 by stefan wolf.

Failed on 8.3.7. :(

The system log says that the cluster has been initialized without and the server has been compiled with HAVE_INT64_TIMESTAMP.

2009-07-27 10:55:49 CEST u: db: tr:0 FATAL: Datenbankdateien sind inkompatibel mit Server 2009-07-27 10:55:49 CEST u: db: tr:0 DETAIL: Der Datenbank-Cluster wurde ohne HAVE_INT64_TIMESTAMP initialisiert, aber der Server wurde mit HAE_INT64_TIMESTAMP kompiliert. 2009-07-27 10:55:49 CEST u: db: tr:0 TIPP: Es sieht so aus, dass Sie neu kompilieren oder initdb ausführen müssen.

The cluster has been initialized manually (in order to support LATIN1) with:

initdb --locale=German_Germany.28591 -W -A md5 -D "C:\Programme\PostgreSQL\8.3\data"

Posted on Jul 27, 2009 at 09:11 by Peter Seifert.

Oh, crap. Ok, the reason for that - it's built with the same parameters as the on-click installer, but I bet you installed from the MSI...

Posted on Jul 27, 2009 at 09:14 by Magnus Hagander.

Yes - it's an install from the MSI-version.

Posted on Jul 27, 2009 at 09:19 by Peter Seifert.

Ok, I'm afraid we currently don't have any patched binaries available for that one as they were built by the same buildfarm that builds the oneclick installers.

Posted on Jul 27, 2009 at 09:23 by Magnus Hagander.

I've deployed the 8.4.0 binary on my development machine. No issues until now (nor there were before btw).

Posted on Jul 27, 2009 at 11:25 by Matteo Beccati.

Tested it on Windows 7 using PG 8.4 and everything seems to work fine (I've done only a very short test: starting the server and creating a table).

Hope this helps.

Best regards.

Posted on Jul 28, 2009 at 06:50 by Cd-MaN.

Thanks for testing!

One good thing to test would be to simply connect and disconnect a number of times - that's when the issue usually show up. Or perhaps run pg_bench on it (don't care about the numbers or anything, but it will run a bunch of queries over some time).

Posted on Jul 28, 2009 at 08:58 by Magnus Hagander.

I've also ran pgbench and everything seems fine (it ran without errors).

Posted on Jul 28, 2009 at 10:05 by Cd-MaN.

I did test for one day (Windows Vista). There is no error message anymore.

Thank you.

Posted on Jul 28, 2009 at 10:15 by Pairat.

This is the second day with the 8.3.7 patch - and this is my first errormessage:

ERROR: cout not stat file "base/17182/18677": Permission denied

I closed the connection (pgAdmin III 1.8.4) and re-connected without errors.

Posted on Jul 28, 2009 at 12:56 by stefan wolf.

Will binaries be a provided for those that install using the MSI Installer? Would love to test this patch as this bug has been a huge problem for us. Thanks for any help.

Posted on Aug 30, 2009 at 13:27 by Mark Merendino.

No, if you need the installer you need to wait until the next minor version release. This is expected out within a couple of weeks though, so the wait won't be too long.

Posted on Aug 30, 2009 at 13:32 by Magnus Hagander.

Oooo, can't wait to try this out! I've been getting hundreds of those errors on Windows Server 2008 with both 8.3.7 and 8.4.

Posted on Sep 11, 2009 at 23:22 by Tyler Burd.

Is this still available for 8.4 and does it work. A production server started getting this error last week after a Windows update, And I'm hoping this will fix it! the link to the 8.4 file is broken...


Posted on Jan 24, 2011 at 15:08 by Miguel Alho.


First, forgiving my English. I translated it with google.

And now my question, this patch really work? I need to solve this problem in 25 installations of postgres. The links doesn't work, could you provide me the patch?

Thank you very much.

Posted on Jul 21, 2011 at 12:46 by Victor.

This patch has been included in all supported versions of PostgreSQL. Do you not need a separate patch.

Posted on Aug 16, 2011 at 14:07 by Magnus Hagander.

Thanks for your reply!

My postgres version is 8.3. Greater version resolve my problem?

Posted on Aug 17, 2011 at 09:32 by Victor.

8.3 is a supported version, so it is already solved. According to the release notes, you need 8.3.8 or newer ( Obviously, you should be on 8.3.15 if you are using 8.3.

Posted on Aug 17, 2011 at 11:38 by Magnus Hagander.

Add comment

New comments can no longer be posted on this entry.


I speak at and organize conferences around Open Source in general and PostgreSQL in particular.



PGConf.DEV 2024
May 28-31, 2024
Vancouver, Canada
PGDay Chicago 2024
Apr 26, 2024
Chicago, USA
SCaLE 2024
Mar 14-17, 2024
Pasadena, USA
Nordic PGDay 2024
Mar 12, 2024
Oslo, Norway
Feb 2-4, 2024
Brussels, Belgium
More past conferences