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:
- Install PG 17.5 on a windows machine from the EDB community release
- 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.
- 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:
- the same hardware and Operating system runs PG 13.18 without those error messages.
- 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
-
5What is your question? If you want to report a bug, here's how.mustaccio– mustaccio2025年06月10日 18:58:47 +00:00Commented Jun 10 at 18:58
-
2Same error seemes to happen using vesieon 15 or 16, see stackoverflow.com/a/67209054/724039 I would file a bug reportLuuk– Luuk2025年06月10日 19:15:02 +00:00Commented Jun 10 at 19:15
-
@Luuk I don't really agree that this is the same error as the question you cited. The thing they have in common is it's VM-related but the error message is different and the operating system is different (Windows vs Unix). However I will file a bug report.sevzas– sevzas2025年06月11日 10:46:41 +00:00Commented Jun 11 at 10:46
-
Perhaps something else is gobbling memory on the machine.Laurenz Albe– Laurenz Albe2025年06月11日 10:58:28 +00:00Commented Jun 11 at 10:58
-
1I mean, sure, you can report a bug. I'd say these values are way too high.Laurenz Albe– Laurenz Albe2025年06月11日 11:33:37 +00:00Commented Jun 11 at 11:33
1 Answer 1
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:
- Open Windows Settings
- Open "Update and Security"
- Open "Windows Security"
- Open "App & Browser Control"
- 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.
- Now you see the "Exploit Protection" window with 2 tabs: System Settings and Program Settings. Click on "Program Settings".
- 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)"
-
A link like learn.microsoft.com/en-us/defender-endpoint/…, when messing with Exploit/security settings would be helpful....Luuk– Luuk2025年06月17日 19:24:28 +00:00Commented Jun 17 at 19:24