API virtualization/interfaces returns duplicate results when paginating #3919

Closed
opened 2025-12-29 18:32:05 +01:00 by adam · 0 comments
Owner

Originally created by @volans- on GitHub (Jul 29, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.7.3
  • NetBox version: 2.8.8

Steps to Reproduce

  1. Have some virtual machines with related interfaces, make sure to have more than PAGINATE_COUNT interfaces.
  2. Call the API endpoint /api/virtualization/interfaces/
  3. Get the count value, in my case was 362
  4. Make a second call for all the remaining objects: /api/virtualization/interfaces/?limit=362&offset=50 (where offset is the value of PAGINATE_COUNT).
  5. Merge the results together checking for duplicates

Note: this is how pynetbox performs the calls when asking for all objects and how I discovered the bug.

Expected Behavior

Get all the 362 interfaces of virtual machines, all unique results.

Observed Behavior

I got only 332 unique results. I got 50 results in the first page and 312 in the second page, for what should have been a total of 362 results, but upon inspection I got only 332 unique results and 30 duplicated results in the second page that were already present in the first API call.
It seems like the results are returned without any sorting hence the unpredicted behaviour.
I've also tried invalidate all to clean the cache.
I've verified that making a single call with /api/virtualization/interfaces/?limit=362 returns all 362 results as expected.
Retrying with a clean cache I got the exact same 30 duplicates, so it doesn't seem to be totally random or unpredictable.

Originally created by @volans- on GitHub (Jul 29, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.7.3 * NetBox version: 2.8.8 ### Steps to Reproduce 1. Have some virtual machines with related interfaces, make sure to have more than `PAGINATE_COUNT` interfaces. 2. Call the API endpoint `/api/virtualization/interfaces/` 3. Get the `count` value, in my case was 362 4. Make a second call for all the remaining objects: `/api/virtualization/interfaces/?limit=362&offset=50` (where offset is the value of `PAGINATE_COUNT`). 5. Merge the results together checking for duplicates Note: this is how `pynetbox` performs the calls when asking for all objects and how I discovered the bug. ### Expected Behavior Get all the 362 interfaces of virtual machines, all unique results. ### Observed Behavior I got only 332 unique results. I got 50 results in the first page and 312 in the second page, for what should have been a total of 362 results, but upon inspection I got only 332 unique results and 30 duplicated results in the second page that were already present in the first API call. It seems like the results are returned without any sorting hence the unpredicted behaviour. I've also tried `invalidate all` to clean the cache. I've verified that making a single call with `/api/virtualization/interfaces/?limit=362` returns all 362 results as expected. Retrying with a clean cache I got the exact same 30 duplicates, so it doesn't seem to be totally random or unpredictable.
adam added the type: bugstatus: accepted labels 2025-12-29 18:32:05 +01:00
adam closed this issue 2025-12-29 18:32:05 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3919