[bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR

From: "MauMau" <maumau307(at)gmail(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: [bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR
Date: 2014-01-24 10:42:07
Message-ID: BD0D89EC2438455C9DE0DC94D36912F4@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

My customer reported the following problem on Windows. I'm afraid this is a
serious problem, and I think we should provide a fix in the next minor
release. I've attached a fix, and I would wish it to be back-ported.

[Problem]
The customer is using 64-bit PostgreSQL 9.1.x on Windows Server 2012 R2. He
found the following messages output repeatedly (once per about 3 minutes) in
the event log.

LOG: could not reserve shared memory region (addr=0000000001270000) for
child 0000000000001340: 487
LOG: could not fork autovacuum worker process: A blocking operation was
interrupted by a call to WSACancelBlockingCall.

I found the same problem was reported by another user here:

Re: PG 924, Windows 2012, error code 487
http://www.postgresql.org/message-id/2C0926ABD16BB641A8E2F11A549200425471425A21@PHXCCRPRD01.adprod.bmc.com

In my customer's case, the failed process was autovacuum worker, so there
was no visible impact on their applications. However, as the above mail
suggests, this can happen with any backend process.

[Cause]
This is caused by the improved ASLR (Address Space Layout Randomization) in
Windows 8/2012. That is analyzed in the following mail last year, but the
problem was not addressed:

windows 8 RTM compatibility issue (could not reserve shared memory region
for child)
http://www.postgresql.org/message-id/5046CAEB.4010600@grammatech.com

[Fix]
Disable ASLR when building PostgreSQL modules. This eliminated the log
output in my customer's environment.

I'll add this to the CommitFest if necessary.

Regards
MauMau

Attachment Content-Type Size
disable_ASLR.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2014-01-24 11:08:41 Re: [bug fix] pg_ctl always uses the same event source
Previous Message MauMau 2014-01-24 10:36:52 Re: [patch] Client-only installation on Windows