Rack device count does not change after unassigning a device from a rack #4877

Closed
opened 2025-12-29 19:21:35 +01:00 by adam · 2 comments
Owner

Originally created by @engageant on GitHub (May 5, 2021).

NetBox version

v2.11.2

Python version

3.8

Steps to Reproduce

  1. Go to the /dcim/racks page and make a note of the device count in a particular rack.
  2. Edit a device in that rack, and unassign it from the rack by clicking the 'x' in the Rack field. Save your changes.
  3. Return to the /dcim/racks page and note that the count of devices in that rack still reflects the count including the device you deleted.

This appears to be a redis cache issue. After a period of time, the count corrected itself. I reproduced the issue again and manually invalidated the cache and the count was again correct.

Expected Behavior

The device count should decrement accordingly.

Observed Behavior

The device count for that rack in /dcim/racks is inaccurate (it still includes the device that was "unracked"). Clicking on that count brings you to the list of devices and (correctly) does not contain the unracked device.

Originally created by @engageant on GitHub (May 5, 2021). ### NetBox version v2.11.2 ### Python version 3.8 ### Steps to Reproduce 1. Go to the /dcim/racks page and make a note of the device count in a particular rack. 2. Edit a device in that rack, and unassign it from the rack by clicking the 'x' in the Rack field. Save your changes. 2. Return to the /dcim/racks page and note that the count of devices in that rack still reflects the count including the device you deleted. This appears to be a redis cache issue. After a period of time, the count corrected itself. I reproduced the issue again and manually invalidated the cache and the count was again correct. ### Expected Behavior The device count should decrement accordingly. ### Observed Behavior The device count for that rack in /dcim/racks is inaccurate (it still includes the device that was "unracked"). Clicking on that count brings you to the list of devices and (correctly) does not contain the unracked device.
adam added the type: bug label 2025-12-29 19:21:35 +01:00
adam closed this issue 2025-12-29 19:21:35 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 1, 2021):

Marking this as blocked by #6639 as it's believed to be a caching bug.

@jeremystretch commented on GitHub (Jul 1, 2021): Marking this as blocked by #6639 as it's believed to be a caching bug.
Author
Owner

@jeremystretch commented on GitHub (Jul 8, 2021):

This will be fixed in v3.0 with the removal of queryset caching. The workaround in the interim is to set CACHE_TIMEOUT = 0 in configuration.py.

@jeremystretch commented on GitHub (Jul 8, 2021): This will be fixed in v3.0 with the removal of queryset caching. The workaround in the interim is to set `CACHE_TIMEOUT = 0` in `configuration.py`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4877