[bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR - Mailing list pgsql-hackers

From MauMau
Subject [bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR
Date
Msg-id BD0D89EC2438455C9DE0DC94D36912F4@maumau
Whole thread Raw
Responses Re: [bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR
List 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

pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: [patch] Client-only installation on Windows
Next
From: "MauMau"
Date:
Subject: Re: [bug fix] pg_ctl always uses the same event source