Netbox Homepage Database Connections #3316

Closed
opened 2025-12-29 18:27:39 +01:00 by adam · 2 comments
Owner

Originally created by @dsg-anthony on GitHub (Feb 12, 2020).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.7.1

I have 2 netbox servers running behind a load balancer, the load balancer checks the root path every x amount of times to make sure the app is still running. CACHE is also disabled on these servers.

Steps to Reproduce

  1. Set LOGIN_REQUIRED to false in the configuration.py
  2. Hit the homepage with traffic that is not authenticated
  3. Set LOGIN_REQUIRED to true in the configuration.py
  4. Hit the homepage with traffic that is not authenticated

Expected Behavior

Traffic to not create any database connections

Observed Behavior

Traffic to the homepage causes the application to execute database connections even though no data is presented to the user.

I've attached a graph to illustrate what I'm seeing. At 10:16 I restarted 1 of my netbox servers with LOGIN_REQUIRED which forwards traffic from / to /login

image

Originally created by @dsg-anthony on GitHub (Feb 12, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.8 * NetBox version: 2.7.1 I have 2 netbox servers running behind a load balancer, the load balancer checks the root path every x amount of times to make sure the app is still running. CACHE is also disabled on these servers. <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> ### Steps to Reproduce 1. Set LOGIN_REQUIRED to **false** in the configuration.py 2. Hit the homepage with traffic that is not authenticated 3. Set LOGIN_REQUIRED to **true** in the configuration.py 4. Hit the homepage with traffic that is not authenticated <!-- What did you expect to happen? --> ### Expected Behavior Traffic to not create any database connections <!-- What happened instead? --> ### Observed Behavior Traffic to the homepage causes the application to execute database connections even though no data is presented to the user. I've attached a graph to illustrate what I'm seeing. At 10:16 I restarted 1 of my netbox servers with LOGIN_REQUIRED which forwards traffic from / to /login ![image](https://user-images.githubusercontent.com/43544235/74349442-4364fb00-4d82-11ea-933f-4d6dd4b8d348.png)
adam closed this issue 2025-12-29 18:27:39 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 12, 2020):

Traffic to not create any database connections

Django always creates a database connection. This is not a bug. (Besides, what good would the check be if it didn't connect to the database? The backend database could be down, rendering NetBox inoperable, but your monitoring would report green based on the HTTP daemon being responsive.)

@jeremystretch commented on GitHub (Feb 12, 2020): > Traffic to not create any database connections Django always creates a database connection. This is not a bug. (Besides, what good would the check be if it _didn't_ connect to the database? The backend database could be down, rendering NetBox inoperable, but your monitoring would report green based on the HTTP daemon being responsive.)
Author
Owner

@dsg-anthony commented on GitHub (Feb 12, 2020):

That's what I figured. Maybe this is more of an unexpected behavior type thing.

semi related to #3291

I've changed the health check to hit /metrics which from what I can tell has no database dependency.

@dsg-anthony commented on GitHub (Feb 12, 2020): That's what I figured. Maybe this is more of an unexpected behavior type thing. semi related to #3291 I've changed the health check to hit /metrics which from what I can tell has no database dependency.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3316