Toggling cable from installed, to planned back to installed breaks cable tracing. #4377

Closed
opened 2025-12-29 18:35:24 +01:00 by adam · 6 comments
Owner

Originally created by @jchristopher327 on GitHub (Dec 17, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.9.1
  • NetBox version: 2.10.1

After I connect an interface to another interface or rear port (have only tested these two), then toggle the cable from installed, to planned and back to installed, cable tracing breaks with the following error.

<class 'dcim.models.cables.CablePath.DoesNotExist'>

CablePath matching query does not exist.

Python version: 3.9.1
NetBox version: 2.10.1

Steps to Reproduce

  1. Connect cable to another interface or rear port. Cable tracking works.
  2. Mark cable as planned. Cable tracking works and shows cable as planned.
  3. Mark cable as installed. Cable tracing breaks with the error shown above.

Expected Behavior

Expect that toggling the cable between planned and installed doesn't break tracing.

Observed Behavior

Toggling the cable from installed, to planned back to installed breaks cable tracing.

A side note, I think the icon for a connected and planned cable should be swapped.

Connected cable icon.

Screen Shot 2020-12-17 at 12 48 46 PM

Planned cable icon.

Screen Shot 2020-12-17 at 12 49 00 PM

Originally created by @jchristopher327 on GitHub (Dec 17, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reporting reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, please start a discussion instead: https://github.com/netbox-community/netbox/discussions 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, and that any plugins have been disabled. --> ### Environment * Python version: 3.9.1 * NetBox version: 2.10.1 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. 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 client library such as pynetbox. --> After I connect an interface to another interface or rear port (have only tested these two), then toggle the cable from installed, to planned and back to installed, cable tracing breaks with the following error. ``` <class 'dcim.models.cables.CablePath.DoesNotExist'> CablePath matching query does not exist. Python version: 3.9.1 NetBox version: 2.10.1 ``` ### Steps to Reproduce 1. Connect cable to another interface or rear port. Cable tracking works. 2. Mark cable as planned. Cable tracking works and shows cable as planned. 3. Mark cable as installed. Cable tracing breaks with the error shown above. <!-- What did you expect to happen? --> ### Expected Behavior Expect that toggling the cable between planned and installed doesn't break tracing. <!-- What happened instead? --> ### Observed Behavior Toggling the cable from installed, to planned back to installed breaks cable tracing. A side note, I think the icon for a connected and planned cable should be swapped. Connected cable icon. ![Screen Shot 2020-12-17 at 12 48 46 PM](https://user-images.githubusercontent.com/17171652/102542277-64634000-4066-11eb-8cb5-62feef9c7e85.png) Planned cable icon. ![Screen Shot 2020-12-17 at 12 49 00 PM](https://user-images.githubusercontent.com/17171652/102542173-40076380-4066-11eb-98d0-183101b908da.png)
adam added the type: bugstatus: accepted labels 2025-12-29 18:35:24 +01:00
adam closed this issue 2025-12-29 18:35:24 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 17, 2020):

I'm not able to reproduce the error. Can you elaborate on the exact cable topology you have in place, and what specific action triggers the error (e.g. what button you're clicking)? It would also be helpful if you can enable debugging (set DEBUG=True in configuration.py) and provide the complete stack trace leading to the exception.

@jeremystretch commented on GitHub (Dec 17, 2020): I'm not able to reproduce the error. Can you elaborate on the **exact** cable topology you have in place, and what specific action triggers the error (e.g. what button you're clicking)? It would also be helpful if you can enable debugging (set `DEBUG=True` in `configuration.py`) and provide the complete stack trace leading to the exception.
Author
Owner

@jchristopher327 commented on GitHub (Dec 21, 2020):

Hi Jeremy,

The cable topology is pretty simple where cables are connecting to interfaces for the most part. The button I'm clicking is the third one from the left (see below). I'll click it after creating/connecting a cable to interfaces which transitions it to planned and cable tracing works. Clicking the same button again should transition it to installed, but cable tracing breaks.

Screen Shot 2020-12-17 at 12 48 46 PM

I'll circle back with the stack trace once I get debugging enabled.

@jchristopher327 commented on GitHub (Dec 21, 2020): Hi Jeremy, The cable topology is pretty simple where cables are connecting to interfaces for the most part. The button I'm clicking is the third one from the left (see below). I'll click it after creating/connecting a cable to interfaces which transitions it to planned and cable tracing works. Clicking the same button again should transition it to installed, but cable tracing breaks. ![Screen Shot 2020-12-17 at 12 48 46 PM](https://user-images.githubusercontent.com/17171652/102814555-b0242b00-437f-11eb-8052-ec90d77930c4.png) I'll circle back with the stack trace once I get debugging enabled.
Author
Owner

@jeremystretch commented on GitHub (Dec 21, 2020):

Yes, I understand that. But please elaborate on the specific topology that someone else can build to reproduce the reported issue. I have tried several things but have not been able to reproduce the error.

  1. Connect cable to another interface or rear port.

What does the complete end-to-end path look like?

@jeremystretch commented on GitHub (Dec 21, 2020): Yes, I understand that. But please elaborate on the specific topology that someone else can build to reproduce the reported issue. I have tried several things but have not been able to reproduce the error. > 1. Connect cable to another interface or rear port. What does the complete end-to-end path look like?
Author
Owner

@jchristopher327 commented on GitHub (Dec 21, 2020):

Here's a cable trace showing the path. I did the steps to reproduce the error and attached the stack trace.

Screen Shot 2020-12-21 at 11 39 49 AM

Environment:


Request Method: GET
Request URL: http://xxxxxx:8888/dcim/interfaces/1480/trace/

Django Version: 3.1.3
Python Version: 3.9.1
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'django_rq',
 'drf_yasg']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'netbox.middleware.ExceptionHandlingMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.LoginRequiredMiddleware',
 'netbox.middleware.APIVersionMiddleware',
 'netbox.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']



Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 173, in __get__
    rel_obj = self.field.get_cached_value(instance)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
    return instance._state.fields_cache[cache_name]

During handling of the above exception ('_path'), another exception occurred:
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/dcim/views.py", line 2115, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 91, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic.py", line 70, in get
    **self.get_extra_context(request, instance),
  File "/opt/netbox/netbox/dcim/views.py", line 2122, in get_extra_context
    path = instance._path
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 187, in __get__
    rel_obj = self.get_object(instance)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 154, in get_object
    return qs.get(self.field.get_reverse_related_filter(instance))
  File "/usr/local/lib/python3.9/site-packages/cacheops/query.py", line 353, in get
    return qs._no_monkey.get(qs, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 429, in get
    raise self.model.DoesNotExist(

Exception Type: DoesNotExist at /dcim/interfaces/1480/trace/
Exception Value: CablePath matching query does not exist.
@jchristopher327 commented on GitHub (Dec 21, 2020): Here's a cable trace showing the path. I did the steps to reproduce the error and attached the stack trace. ![Screen Shot 2020-12-21 at 11 39 49 AM](https://user-images.githubusercontent.com/17171652/102815593-705e4300-4381-11eb-8da5-0dd6f59d714b.png) ``` Environment: Request Method: GET Request URL: http://xxxxxx:8888/dcim/interfaces/1480/trace/ Django Version: 3.1.3 Python Version: 3.9.1 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'cacheops', 'corsheaders', 'debug_toolbar', 'django_filters', 'django_tables2', 'django_prometheus', 'mptt', 'rest_framework', 'taggit', 'timezone_field', 'circuits', 'dcim', 'ipam', 'extras', 'secrets', 'tenancy', 'users', 'utilities', 'virtualization', 'django_rq', 'drf_yasg'] Installed Middleware: ['debug_toolbar.middleware.DebugToolbarMiddleware', 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'netbox.middleware.ExceptionHandlingMiddleware', 'netbox.middleware.RemoteUserMiddleware', 'netbox.middleware.LoginRequiredMiddleware', 'netbox.middleware.APIVersionMiddleware', 'netbox.middleware.ObjectChangeMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware'] Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 173, in __get__ rel_obj = self.field.get_cached_value(instance) File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value return instance._state.fields_cache[cache_name] During handling of the above exception ('_path'), another exception occurred: File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/dcim/views.py", line 2115, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 91, in dispatch return super().dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/netbox/views/generic.py", line 70, in get **self.get_extra_context(request, instance), File "/opt/netbox/netbox/dcim/views.py", line 2122, in get_extra_context path = instance._path File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 187, in __get__ rel_obj = self.get_object(instance) File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 154, in get_object return qs.get(self.field.get_reverse_related_filter(instance)) File "/usr/local/lib/python3.9/site-packages/cacheops/query.py", line 353, in get return qs._no_monkey.get(qs, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 429, in get raise self.model.DoesNotExist( Exception Type: DoesNotExist at /dcim/interfaces/1480/trace/ Exception Value: CablePath matching query does not exist. ```
Author
Owner

@jeremystretch commented on GitHub (Dec 21, 2020):

Ah, I see. This seems to be a caching bug. Just to confirm, if you disable caching by setting CACHE_TIMEOUT = 0 in configuration.py, can you still reproduce the problem?

@jeremystretch commented on GitHub (Dec 21, 2020): Ah, I see. This seems to be a caching bug. Just to confirm, if you disable caching by setting `CACHE_TIMEOUT = 0` in `configuration.py`, can you still reproduce the problem?
Author
Owner

@jchristopher327 commented on GitHub (Dec 21, 2020):

I cannot reproduce the problem after setting CACHE_TIMEOUT = 0.

@jchristopher327 commented on GitHub (Dec 21, 2020): I cannot reproduce the problem after setting `CACHE_TIMEOUT = 0`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4377