1

In PG 17.5 on Windows, I'm seeing errors in the log that look like:

2025-06-10 12:53:44.548 EDT [18612] LOG:  could not reserve shared memory region (addr=0000022916760000) for child 00000000000014C4: error code 487
2025-06-10 13:09:44.667 EDT [18612] LOG:  could not reserve shared memory region (addr=0000022916760000) for child 00000000000014A8: error code 487
2025-06-10 13:14:44.797 EDT [18612] LOG:  could not reserve shared memory region (addr=0000022916760000) for child 00000000000014CC: error code 487

I was able to duplicate the issue fairly easily in two unconnected/unrelated environments. The issue appears to be triggered/exacerbated by higher settings of shared_buffers in postgresql.conf

Steps to replicate:

  1. Install PG 17.5 on a windows machine from the EDB community release
  2. In the default postgresql.conf that is created by the installer, change shared_buffers as follows: On an 8GB laptop (windows 11), I changed shared_buffers to 3GB. On a 768 GB Dell server (Windows Server 2019), changing shared_buffers to 256GB showed the error message quite often but with shared_buffers=128GB it took a couple of minutes for the message to appear.
  3. Start the cluster with pg_ctl and watch the output. The higher the setting of shared_buffers, the more frequent the messages appear. On the 8 GB laptop, it took over 30 minutes to see the first message. On the Dell server I was getting those messages sometimes even before the server was ready to accept connections.

Notes:

  1. the same hardware and Operating system runs PG 13.18 without those error messages.
  2. There are no active connections or queries running during my testing

I set the logging to Debug5 and here are some associated messages. PID 19048 is the postmaster, not sure what PID 14992 is doing:

2025-06-10 10:11:47.402 EDT [14992] [] DEBUG:  StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS
, xid/subid/cid: 0/1/0
2025-06-10 10:11:47.402 EDT [14992] [] DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRES
S, xid/subid/cid: 0/1/0
2025-06-10 10:11:47.402 EDT [19048] [] DEBUG:  postmaster received pmsignal signal
2025-06-10 10:11:47.402 EDT [19048] [] DEBUG:  mapped win32 error code 2 to 2
2025-06-10 10:11:47.403 EDT [19048] [] DEBUG:  mapped win32 error code 2 to 2
2025-06-10 10:11:47.406 EDT [19048] [] LOG:  could not reserve shared memory region (addr=000001A228F90000) for child 0000000000002168: error code 487
sevzas
  • 373
  • 3
  • 12

1 Answers1

0

After a lot of google searches, I have verified that to get rid of the "error code 487" errors on Windows, Address Space Layout Randomization (ASLR) needs to be disabled for pg_ctl.exe and postgres.exe .

How to disable ASLR on Windows Server 2019 for specific programs:

  1. Open Windows Settings
  2. Open "Update and Security"
  3. Open "Windows Security"
  4. Open "App & Browser Control"
  5. Now the menus on the left side include "Home", "Virus & Threat Protection", "Firewall & network protection", "App & browser control" and "Device Security". There is a link "Exploit protection settings" in the center of the window, near the bottom. Click on it.
  6. Now you see the "Exploit Protection" window with 2 tabs: System Settings and Program Settings. Click on "Program Settings".
  7. Click on "Add program to customize", "Add by program name". You will customize for two programs: "pg_ctl.exe" and "postgres.exe". The only necessary customization is to disable "Randomize memory allocations (Bottom-up ASLR)"
sevzas
  • 373
  • 3
  • 12