max_temp_directory_size in connect config is reported but not enforced
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Run the reproduction script first to confirm the two runs differ: the apply_set=False run should succeed while the apply_set=True run raises OutOfMemoryException. Then trace how the max_temp_directory_size key in the config= mapping passed to duckdb.connect is applied during connection initialization, and compare that with the path SET max_temp_directory_size takes. Done means the connect-time 1-byte cap rejects the spill just as the SET run does, and the same script passes both cases.
索引モデルが issue の本文から書いたものです。
説明
What happens?
Passing max_temp_directory_size through duckdb.connect(config=...) makes current_setting('max_temp_directory_size') report the requested value, but spilling is not bounded by it. Executing the same value with SET max_temp_directory_size after the connection is created enforces the cap.
This can silently let a Python process consume the filesystem space that the connect-time configuration was intended to reserve.
To Reproduce
This self-contained script generates its own Parquet input and runs the same external sort twice:
import tempfile
from pathlib import Path
import duckdb
def run(apply_set: bool) -> None:
root = Path(tempfile.mkdtemp())
source = root / "source.parquet"
output = root / "output.parquet"
with duckdb.connect() as connection:
connection.sql(
"""
SELECT
i AS row_id,
i % 17 AS group_id,
repeat(md5(i::VARCHAR), 32) AS payload
FROM range(49152) t(i)
"""
).write_parquet(str(source), row_group_size=2048)
with duckdb.connect(
str(root / "test.duckdb"),
config={
"memory_limit": "64MB",
"threads": 2,
"temp_directory": str(root / "tmp"),
"preserve_insertion_order": False,
"max_temp_directory_size": "1B",
},
) as connection:
if apply_set:
connection.execute("SET max_temp_directory_size = '1B'")
print("apply_set", apply_set)
print(
"setting",
connection.execute(
"SELECT current_setting('max_temp_directory_size')"
).fetchone(),
)
try:
connection.read_parquet(str(source)).order(
"group_id, payload, row_id"
).write_parquet(str(output), row_group_size=2048)
print("sort succeeded")
except Exception as error:
print(type(error).__name__, str(error).splitlines()[0])
run(apply_set=False)
run(apply_set=True)
Output with DuckDB 1.5.6:
apply_set False
setting ('1 byte',)
sort succeeded
apply_set True
setting ('1 byte',)
OutOfMemoryException Out of Memory Error: failed to offload data block of size 32.0 KiB (0 bytes/1 byte used).
Expected: both runs reject the spill at the 1-byte cap.
The behavior also reproduces with DuckDB 1.5.2. This is specific to initialization through the Python config mapping, so there is no equivalent plain-SQL/CLI connect-time reproduction; the post-connect SQL SET is the working comparison.
Environment
- OS: macOS 27.0, arm64
- DuckDB Package Version: 1.5.6 (latest stable; also 1.5.2)
- Python Version: 3.13.14
- Full Name: Simon Thelin
- Affiliation: Odyssey
- Latest build tested: stable release
- Data set: not applicable; the reproduction generates its input
- All code and relevant configuration are included
- 主要言語
- Python
- スター
- 191
- フォーク
- 120
- 平均マージ
- 14時間 1分
- マージ済み PR(30日)
- 23
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
duckdb/duckdb-python のほかの issue
-
duckdb.experimental.spark fails to import without typing_extensions, which is not a runtime dependency対応中かも @evertlammerts が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
duckdb/duckdb-python#653 ·
メンテナーはふだん 1 日以内に返信
-
Type stubs omit the `connection` keyword on module-level `read_json` and `write_csv`対応中かも @tojacob03 が 17 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
duckdb/duckdb-python#627 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`read_json` accepts a list of paths at runtime but the type stub only allows a single path.対応中かも @aleks-drozy が 75 日前に担当しました。 オープンneeds triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
duckdb/duckdb-python#576 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Possible reference leak of the argument tuple in `FunctionCall()`対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンneeds triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
duckdb/duckdb-python#534 ·
メンテナーはふだん 1 日以内に返信
-
Missing ROW_GROUPS_PER_FILE argument in write_parquet function対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンneeds triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
duckdb/duckdb-python#386 ·
メンテナーはふだん 1 日以内に返信
duckdb/duckdb-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
omegaup/omegaup#10353 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
-
bot-triaged module: LrScheduler module: optimizer triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
documentation glm5 llm-model
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vllm-project/vllm-ascend#19062 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
acl-org/acl-anthology#10496 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信