Thread

  1. BUG #19105: Parallel Hash Join crash when work_mem is small

    PG Bug reporting form <noreply@postgresql.org> — 2025-11-08T22:01:45Z

    The following bug has been logged on the website:
    
    Bug reference:      19105
    Logged by:          Nagesh Ka
    Email address:      nageshdbaa@gmail.com
    PostgreSQL version: 16.2
    Operating system:   Ubuntu 22.04 x86_64
    Description:        
    
    PostgreSQL version: 16.2 (Ubuntu 22.04 x86_64)
    Compiled by gcc (Ubuntu 11.4.0)
    work_mem = 1MB
    max_parallel_workers_per_gather = 4
    
    CREATE TABLE t1 AS SELECT i, md5(i::text) AS txt FROM
    generate_series(1,1000000) i;
    CREATE TABLE t2 AS SELECT i, md5(i::text) AS txt FROM
    generate_series(1,1000000) i;
    
    SET work_mem = '1MB';
    SET max_parallel_workers_per_gather = 4;
    
    SELECT t1.i, count(*)
    FROM t1 JOIN t2 USING(i)
    GROUP BY t1.i;
    
    -->Expected Result
    
    Query should complete successfully and return a count for each key.
    
    -->Observed Result
    
    Server terminates with:
    
    ERROR:  could not attach to dynamic shared area
    DETAIL:  invalid dsa_handle
    
    
  2. Re: BUG #19105: Parallel Hash Join crash when work_mem is small

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-09T15:47:25Z

    PG Bug reporting form <noreply@postgresql.org> writes:
    > PostgreSQL version: 16.2
    
    > Server terminates with:
    
    > ERROR:  could not attach to dynamic shared area
    > DETAIL:  invalid dsa_handle
    
    I could not reproduce this problem with current sources
    (either master or v16 branch tip).  16.2 is pretty old,
    so maybe an update will fix it for you.
    
    			regards, tom lane
    
    
    
    
  3. Re: BUG #19105: Parallel Hash Join crash when work_mem is small

    Tomas Vondra <tomas@vondra.me> — 2025-11-09T17:49:13Z

    On 11/9/25 16:47, Tom Lane wrote:
    > PG Bug reporting form <noreply@postgresql.org> writes:
    >> PostgreSQL version: 16.2
    > 
    >> Server terminates with:
    > 
    >> ERROR:  could not attach to dynamic shared area
    >> DETAIL:  invalid dsa_handle
    > 
    > I could not reproduce this problem with current sources
    > (either master or v16 branch tip).  16.2 is pretty old,
    > so maybe an update will fix it for you.
    > 
    
    FWIW I couldn't reproduce it on 16.2 either, even after forcing it to
    actually do parallel hash join (the posted instructions were not enough
    to make that happen on my system).
    
    Presumably there's some additional detail making it fail, but there are
    too many options to guess. Maybe it's some kernel limit, something in
    ubuntu 22.04, or something else.
    
    It's interesting the report claims this happens only "when work_mem is
    small". I wonder if that happens simply because the plan changes.
    
    
    regards
    
    -- 
    Tomas Vondra
    
    
    
    
    
  4. Re: BUG #19105: Parallel Hash Join crash when work_mem is small

    Thomas Munro <thomas.munro@gmail.com> — 2025-11-09T22:35:10Z

    On Mon, Nov 10, 2025 at 4:23 AM PG Bug reporting form
    <noreply@postgresql.org> wrote:
    > ERROR:  could not attach to dynamic shared area
    > DETAIL:  invalid dsa_handle
    
            ereport(ERROR,
                    (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                     errmsg("could not attach to dynamic shared area")));
    
    Where do we emit that DETAIL message?
    
    
    
    
  5. Re: BUG #19105: Parallel Hash Join crash when work_mem is small

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-09T23:40:55Z

    Thomas Munro <thomas.munro@gmail.com> writes:
    > On Mon, Nov 10, 2025 at 4:23 AM PG Bug reporting form
    > <noreply@postgresql.org> wrote:
    >> ERROR:  could not attach to dynamic shared area
    >> DETAIL:  invalid dsa_handle
    
    >         ereport(ERROR,
    >                 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
    >                  errmsg("could not attach to dynamic shared area")));
    
    > Where do we emit that DETAIL message?
    
    I'd not picked up on that point, but you're right: we don't emit any
    such DETAIL anywhere, not in current and not in 16.2 either.  Must
    be a locally-modified tree, or maybe just a copy-paste error in the
    report?
    
    			regards, tom lane