Skip to content

Bug: Database() with max_num_threads=0 hangs every query since 0.23.0 #82

Done

Description

@zahariash

This work was produced with the help of language models.

On 0.23.0, a Database opened with max_num_threads=0 never returns from its first statement, not even RETURN 1:

import ladybug as lb

db = lb.Database(":memory:", max_num_threads=0)
conn = lb.Connection(db)
conn.execute("RETURN 1")  # never returns

buffer_pool_size=0 fails at open instead:

RuntimeError: Buffer manager exception: The given buffer pool size should be at least 4096 bytes.

Expected: 0 uses the engine default, as on 0.22.3, where 0 was the default value of both parameters: one thread per logical CPU, and about 80% of memory for the buffer pool.

Actual: the hung process has a single thread, because the engine started no query workers.

Reproduces on 0.23.0 with the pybind backend. That is the backend the wheels run, since they don't bundle the C API library. 0.22.3 is clean. max_num_threads=1, max_num_threads=4 and leaving it unset all work on 0.23.0.

Cause. Since #77, PyDatabase starts from SystemConfig() and then assigns each value that is set. Only the SystemConfig constructor turns 0 into the default for bufferPoolSize and maxNumThreads, so a 0 assigned afterwards stays 0. The C-API backend is not affected, because lbug_database_init passes the values through the constructor.

Fix: #83

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions