REST updates can deadlock with activation or uploads on NetBox v4.7.4
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start by tracing the update hooks for Script Projects and Script Files alongside the activation and upload paths; the issue does not name specific files or tests. Reproduce the overlapping requests in two sessions, including the reported Project PATCH and activation case, then inspect how each path acquires row and advisory locks. Done means concurrent updates, activation, and uploads wait without deadlocking while validation, permissions, and If-Match behavior still apply.
Written by the indexing model from the issue text.
Description
Plugin Version
v0.0.1
NetBox Version
v4.7.4
Python Version
3.12
Steps to Reproduce
The operations must overlap; the timing window is narrow.
- Create a Script Project with a valid revision available for activation.
- Start activating that revision.
- At the same time, send
PATCH /api/plugins/netbox-scripts/projects/<id>/for that Project with{"description": "edited"}.
The same lock-order conflict exists for Script Files: upload a file that re-enables an existing disabled Script File while another request updates that file through PATCH /api/plugins/netbox-scripts/script-files/<id>/.
Single and bulk PUT/PATCH updates are affected. The conflict does not require If-Match.
Expected Behavior
Concurrent operations use a consistent lock order and wait for each other without deadlocking. Normal validation, permission checks, and If-Match handling still apply.
Observed Behavior
NetBox v4.7.4 locks the updated rows before the plugin's update hooks acquire the Project's advisory lock. Activation and uploads acquire these locks in the opposite order. If the operations overlap at these points, each can hold the lock the other needs.
The Project PATCH/activation case was reproduced in a controlled two-session test, both with and without If-Match. PostgreSQL raised deadlock detected (SQLSTATE 40P01) for PATCH while activation completed.
- Dominant language
- Python
- Stars
- 8
- Forks
- 0
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from netbox-community/netbox-scripts
-
app: scripts severity: medium status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#83 ·
Maintainers usually reply within 1 day
-
app: scripts status: backlog type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
netbox-community/netbox-scripts#80 ·
Maintainers usually reply within 1 day
-
app: scripts severity: medium status: backlog type: bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
netbox-community/netbox-scripts#79 ·
Maintainers usually reply within 1 day
-
app: scripts severity: medium status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#77 ·
Maintainers usually reply within 1 day
-
app: scripts severity: low status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
netbox-community/netbox-scripts#76 ·
Maintainers usually reply within 1 day
All issues in netbox-community/netbox-scripts
Similar issues
-
infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
NatLabRockies/H2Integrate#977 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
topoteretes/cognee#6470 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
area:docs priority:p2 type:docs wave:9
Difficulty 1/5 Under an hour Newbie friendliness 84/100
jejjohnson/radtrax#293 ·
Maintainers usually reply within 1 day
-
bug core plugins
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bunkerity/bunkerweb#4121 · 1 comment ·
Maintainers usually reply within 1 day