Concurrent bulk writes can deadlock when acquiring Project locks
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
Start by tracing Project lock acquisition for REST bulk updates, UI bulk edits, imports, and bulk deletion; the issue names no source files or tests. Compare how each path orders locks, especially when a Project is renamed while requests overlap. Done means all these paths use a common immutable lock order and the reproduction completes without a deadlock.
索引モデルが issue の本文から書いたものです。
説明
Plugin Version
v0.0.1
NetBox Version
v4.7.4
Python Version
3.12
Steps to Reproduce
Run the requests from separate clients so they can overlap.
- Create two Script Projects named Alpha Devices and Bravo Devices, with unique project keys. Note their IDs.
- In
manage.py nbshell, hold Alpha's advisory lock. Keep the shell open until the final step.from django.db import connection from netbox_scripts.models import ScriptProject from netbox_scripts.storage.locks import advisory_key project = ScriptProject.objects.get(name='Alpha Devices') key = advisory_key(project.storage_key) cursor = connection.cursor() cursor.execute('SELECT pg_advisory_lock(%s, %s)', key) - Send a bulk
PATCHto/api/plugins/netbox-scripts/projects/, replacing the placeholders with the Projects' IDs:
Leave this request running while it waits for Alpha's lock.[ {"id": <alpha_id>, "description": "first"}, {"id": <bravo_id>, "description": "first"} ] - In another client, rename Bravo Devices to Aardvark Devices.
- Send another bulk update for the same two IDs, changing the description to
"second". Leave this request running too. - Once both requests are waiting, release Alpha's lock in the shell:
cursor.execute('SELECT pg_advisory_unlock(%s, %s)', key) cursor.close()
Expected Behavior
Both requests complete without deadlocking. Concurrent bulk writes acquire Project locks in a consistent order, regardless of Project names.
Observed Behavior
One request fails with HTTP 500 and OperationalError: deadlock detected. The other request succeeds.
The first request collects its locks in name order, with Alpha before Bravo. After the rename, the second request takes Aardvark's lock before waiting for Alpha. When the shell releases Alpha's lock, each request can hold the lock the other needs.
The same failure was reproduced with two UI bulk edits and with a UI bulk edit overlapping a REST bulk update.
This is the follow-up discussed in #104. The fix needs a common immutable lock order across REST bulk updates, UI bulk edits and imports, and Project bulk deletion.
- 主要言語
- Python
- スター
- 8
- フォーク
- 0
- 平均マージ
- 11時間 22分
- マージ済み PR(30日)
- 40
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
netbox-community/netbox-scripts のほかの issue
-
app: scripts Bucket: Improve status: backlog type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
netbox-community/netbox-scripts#80 ·
メンテナーはふだん 1 日以内に返信
-
app: scripts Bucket: KTLO severity: low status: backlog type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
netbox-community/netbox-scripts#76 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Raise the minimum NetBox version to v4.7.5対応中かも @pheus が 2 日前に担当しました。 オープンapp: scripts Bucket: KTLO status: backlog type: housekeeping
netbox-community/netbox-scripts#123 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
A committed run is reported as unfinished when its events cannot be queued対応中かも @pheus が 2 日前に担当しました。 オープンapp: scripts Bucket: KTLO severity: low status: accepted type: bug
netbox-community/netbox-scripts#122 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Failed post-commit callback reports committed changes as reverted and drops events対応中かも @pheus が 2 日前に担当しました。 オープンapp: scripts Bucket: KTLO severity: low status: accepted type: bug
netbox-community/netbox-scripts#121 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
netbox-community/netbox-scripts の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
vllm-project/vllm-omni#10051 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Testing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SCIInstitute/SCIRun#2931 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 5 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
acl-org/acl-anthology#10827 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
marimo-team/marimo#11768 ·
メンテナーはふだん 1 日以内に返信