Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

REST updates can deadlock with activation or uploads on NetBox v4.7.4

Open
#66 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, python
Domain
backend, databases

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

app: scripts severity: medium status: backlog type: bug
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.

  1. Create a Script Project with a valid revision available for activation.
  2. Start activating that revision.
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netbox-community/netbox-scripts

All issues in netbox-community/netbox-scripts

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.