leaked hash_seq_search scan for hash table warning in join · Issue #15 · documentdb/documentdb · GitHub
Skip to content

leaked hash_seq_search scan for hash table warning in join #15

Closed

Description

@marcoslot

Describe the bug
If I run the join query from the readme twice in the same session I get a leaked hash_seq_search scan for hash table warning.

Environment

Ubuntu 22.04 on WSL with PostgreSQL 16.5

Reproduction Steps

SELECT cursorpage FROM documentdb_api.aggregate_cursor_first_page('documentdb', $$                                                                                                                                                          { 
  "aggregate": "patient",
  "pipeline": [ 
    { 
        "$lookup": { 
          "from": "appointment",
          "localField": "patient_id", 
          "foreignField": "patient_id", 
          "as": "appointment" 
        }
    },
    {
        "$unwind":"$appointment"
    },
    {
        "$project": {
          "_id":0,
          "name":1,
          "appointment.doctor_name":1,
          "appointment.appointment_date":1
        }
    }
  ], 
  "cursor": { "batchSize": 3 } 
}
$$);

Expected behavior
No leak warning

** Actual behavior **

NOTICE:  There are open held portals. Closing them
WARNING:  leaked hash_seq_search scan for hash table 0x55d1eb54fce8

Activity

  1. self-assigned this
    on Jan 25, 2025
  2. self-assigned this
    on Jan 27, 2025
  3. diipak-bisht commented on Jan 27, 2025

    @diipak-bisht
    Contributor

    The issue is PG complains about any non-terminated hash_search at the txn commit time, and the non-terminating hash_search starts in CreateAndDrainPersistedQuery function which tries to close all previously open portals with ThereAreNoReadyPortals.

    The hash table is private and there is not much APIs to access it or freeze it before starting hash_search so that PG would not complain.

  4. visridha commented on Jan 28, 2025

    @visridha
    Contributor

    We're actively looking at this. This should be resolved soon - and we're refactoring the code to not scan all cursors and prune them.

  5. added this to the 0.101-0 milestone on Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions