Skip to content

_find_tables schedules one graph query per embedding without a concurrency bound #716

Description

@Nievesjyl

Description

_find_tables() processes the supplied embeddings by starting one graph query for each embedding concurrently.

There is no concurrency bound around these per-embedding graph queries.

As a result, the number of simultaneously active graph queries grows directly with the number of embeddings supplied to the function.

I reproduced this behavior with 512 controlled embeddings.

Observed behavior:

Input embeddings: 512
Peak active graph queries: 512
Pending child tasks before release: 512
External service contacted: No

A large embedding collection can therefore produce a correspondingly large burst of outstanding graph queries instead of maintaining bounded query concurrency.

Affected Version

Confirmed on:

queryweaver==0.3.1
Python 3.12.13
api/graph.py:105-138
_find_tables()

Other versions have not been tested.

Reproduction

The attached PoC executes the released _find_tables() implementation with 512 controlled embeddings.

The graph-query boundary is replaced with a local asynchronous operation that records active calls and waits on a shared gate. This allows the number of graph queries admitted by _find_tables() to be measured before any operation completes.

Observed result:

input embeddings: 512
peak active queries: 512
pending child tasks before release: 512
fan-out reproduced: yes

All 512 graph queries become active before any of them is released.

No graph database or other external service is contacted during reproduction.

Expected behavior

Graph-query concurrency should remain bounded for large embedding collections rather than growing directly with the total number of input embeddings.

A semaphore, bounded worker pool, or batched scheduling strategy could preserve concurrent querying while limiting the number of simultaneously outstanding graph operations.

Attachment

run.py

embeddings.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions