Simultaneous API updates some fields of a record (PATCH method) made unexpected result. #7941

Closed
opened 2025-12-29 20:30:17 +01:00 by adam · 2 comments
Owner

Originally created by @Tomoyuki-GH on GitHub (Apr 25, 2023).

NetBox version

v3.4.6 (netboxcommunity/netbox v3.4-2.4.0 docker image)

Python version

3.10

Steps to Reproduce

  1. prepare 2 netbox API clients.
    • client X for updates a data field on a record(say record-A) with varying values continuously.
    • client Y for updates a data field (differ from client X) on the same record-A, with varying values continuously.
  2. run these clients(X, Y) simultaneously.
  3. see the result of record-A would be unexpected.

Expected Behavior

  • for example, counting up the field P from 0 to 100 with client X, and the field Q from 900 to 1000 with client Y.
  • field P and Q are on the same data record(e.g. one on dicm.device)
  • run the clients simultaneously and the time goes by, we expected the field P should be 100 and the field Q should be 1000.

Observed Behavior

  • sometimes P: 91, Q: 988.
Originally created by @Tomoyuki-GH on GitHub (Apr 25, 2023). ### NetBox version v3.4.6 (netboxcommunity/netbox v3.4-2.4.0 docker image) ### Python version 3.10 ### Steps to Reproduce 1. prepare 2 netbox API clients. * client X for updates a data field on a record(say record-A) with varying values continuously. * client Y for updates a data field (differ from client X) on the same record-A, with varying values continuously. 2. run these clients(X, Y) simultaneously. 3. see the result of record-A would be unexpected. ### Expected Behavior * for example, counting up the field P from 0 to 100 with client X, and the field Q from 900 to 1000 with client Y. * field P and Q are on the same data record(e.g. one on dicm.device) * run the clients simultaneously and the time goes by, we expected the field P should be 100 and the field Q should be 1000. ### Observed Behavior * sometimes P: 91, Q: 988.
adam closed this issue 2025-12-29 20:30:17 +01:00
Author
Owner

@arthanson commented on GitHub (Apr 26, 2023):

@Tomoyuki-GH I'm not sure this is a bug (or at least a NetBox bug) if I'm understanding your description above. If you run two API clients then there are a bunch of variables here:

  1. each client could have different timing depending if they are on different machines, different connections, etc.. even if on the same machine the task scheduler, while it should be close, will be different between two clients.
  2. On the NetBox instance it depends on how the server is setup, what load balancer you are using, how you have the gunicorn and nginx configured for workers and threads and what other connections are coming in.

From the description this sounds more likely a configuration issue with the server which would effect how the load balancing and task handling is run. If you run two clients I would not expect their counts to be the same. If the server is configured for roughly equal load balance then I'd expect the numbers to be somewhat close but not exactly the same.

@arthanson commented on GitHub (Apr 26, 2023): @Tomoyuki-GH I'm not sure this is a bug (or at least a NetBox bug) if I'm understanding your description above. If you run two API clients then there are a bunch of variables here: 1. each client could have different timing depending if they are on different machines, different connections, etc.. even if on the same machine the task scheduler, while it should be close, will be different between two clients. 2. On the NetBox instance it depends on how the server is setup, what load balancer you are using, how you have the gunicorn and nginx configured for workers and threads and what other connections are coming in. From the description this sounds more likely a configuration issue with the server which would effect how the load balancing and task handling is run. If you run two clients I would not expect their counts to be the same. If the server is configured for roughly equal load balance then I'd expect the numbers to be somewhat close but not exactly the same.
Author
Owner

@jeremystretch commented on GitHub (May 2, 2023):

I agree with @arthanson; I don't think there's anything actionable here as a bug report, and the behavior described depends heavily on your deployment. If you'd like to propose a specific improvement that may help mitigate these concerns (without significantly impacting performance), we'd be happy to discuss.

@jeremystretch commented on GitHub (May 2, 2023): I agree with @arthanson; I don't think there's anything actionable here as a bug report, and the behavior described depends heavily on your deployment. If you'd like to propose a specific improvement that may help mitigate these concerns (without significantly impacting performance), we'd be happy to discuss.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7941