Thread

  1. BUG #18954: Error "could not reserve shared memory region ... error code 487" on Windows

    PG Bug reporting form <noreply@postgresql.org> — 2025-06-11T11:22:23Z

    The following bug has been logged on the website:
    
    Bug reference:      18954
    Logged by:          Seva Zaslavsky
    Email address:      szaslavsky@mpcapitallp.com
    PostgreSQL version: 17.5
    Operating system:   Windows Server 2019, Windows 11
    Description:        
    
    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
    https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
        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.  Sometimes the messages appears right away during startup, other
    times it can take a while.
        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: INPROGRESS, 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
    Related DBA StackExchange post:
    https://dba.stackexchange.com/questions/346875/error-could-not-reserve-shared-memory-region-error-code-487-on-postgresql