Tracing yields ZeroDivisionError after Deleting a Rear Port #11218

Closed
opened 2025-12-29 21:42:05 +01:00 by adam · 5 comments
Owner

Originally created by @bin-bern on GitHub (May 26, 2025).

Deployment Type

Self-hosted

NetBox Version

4.2.4

Python Version

3.12

Steps to Reproduce

Note: I reproduced the bug on demo.netbox.dev (v4.3.1).

  1. Create a patch panel with a couple front ports, but only one multiposition rear port.
  2. (Connect a front port to some switch port, so as to have something to look at when you trace it.)
  3. (Find that you need individual rear ports so as to properly pair them with sockets in different locations.)
  4. Create new single-position rear ports, edit the front ports one by one to switch them over.
  5. (Note that the traces still work.)
  6. Delete the old multiposition rear port.
  7. Traces don't work anymore, trying to download the SVG yields a ZeroDivisionError server error.

Expected Behavior

Traces should continue to work, independent of the (continued existence of the now unconnected) old rear port.

Observed Behavior

(As stated above.)

Originally created by @bin-bern on GitHub (May 26, 2025). ### Deployment Type Self-hosted ### NetBox Version 4.2.4 ### Python Version 3.12 ### Steps to Reproduce Note: I **reproduced** the bug on demo.netbox.dev (v4.3.1). 1. Create a patch panel with a couple front ports, but only one multiposition rear port. 2. (Connect a front port to some switch port, so as to have something to look at when you trace it.) 3. (Find that you need _individual_ rear ports so as to properly pair them with sockets in different locations.) 4. Create new single-position rear ports, edit the front ports one by one to switch them over. 5. (Note that the traces still work.) 6. Delete the old multiposition rear port. 7. Traces don't work anymore, trying to download the SVG yields a ZeroDivisionError server error. ### Expected Behavior Traces should continue to work, independent of the (continued existence of the now unconnected) old rear port. ### Observed Behavior (As stated above.)
adam added the type: bugstatus: needs ownerpending closureseverity: low labels 2025-12-29 21:42:05 +01:00
adam closed this issue 2025-12-29 21:42:06 +01:00
Author
Owner

@bin-bern commented on GitHub (May 26, 2025):

Screenshot dump (from demo.netbox.dev):
Initial setup of patch panel:
Image
Successful trace:
Image
Modified to individual rear ports:
Image
SVG download (attempt) from now-empty trace:
Image

@bin-bern commented on GitHub (May 26, 2025): Screenshot dump (from demo.netbox.dev): Initial setup of patch panel: ![Image](https://github.com/user-attachments/assets/ee4bd965-c4c3-485a-9641-022d604ce865) Successful trace: ![Image](https://github.com/user-attachments/assets/b3af266f-818c-4db6-ab0d-4908329cdf04) Modified to individual rear ports: ![Image](https://github.com/user-attachments/assets/9bf71890-3a41-4003-bde7-ea268c4560ca) SVG download (attempt) from now-empty trace: ![Image](https://github.com/user-attachments/assets/5021d54e-878e-4544-b6b1-0617a3743251)
Author
Owner

@arthanson commented on GitHub (May 27, 2025):

@bin-bern can you please check and update your steps to reproduce as I'm not able to reproduce this and the reproduction steps are not clear. I'm not sure what you are entering for the port when you mention "one multiposition rear port" can you please put the repro steps of what exactly you are filling in to the fields for the minimum number of ports needed to reproduce the issue.

@arthanson commented on GitHub (May 27, 2025): @bin-bern can you please check and update your steps to reproduce as I'm not able to reproduce this and the reproduction steps are not clear. I'm not sure what you are entering for the port when you mention "one multiposition rear port" can you please put the repro steps of what exactly you are filling in to the fields for the minimum number of ports needed to reproduce the issue.
Author
Owner

@bin-bern commented on GitHub (May 27, 2025):

It seems that I can reproduce the bug in a simpler setting (and with somewhat different symptoms):

  1. Log in to demo.netbox.dev and pick a rack that already has a switch and a patchpanel. (I chose "Comms closet" at Site "DM-Yonkers", with switch "dmi01-yonkers-sw01" and patchpanel "48-Port Patch Panel".)
  2. Create a new device type, add a rear port with one(!) position, type 8P8C, then a front port of the same type, connected to the rear port('s single position).
  3. Create a new device of that type, role "Patch Panel", and put it into the chosen rack.
  4. Connect the front port to an interface of the switch, and the rear port to a rear port of the other patchpanel, creating two new cables and activating the ports' "Trace" buttons in the process.
  5. (Doing a trace shows a chain from the switch through its port, the test panel's front- and original rear port, and the other panel's rear port to its front port:)
    Image
  6. Add a new (single-position) rear port to the test device, edit the front port to connect to the new rear port instead, edit the cable to the other patch panel to connect it to the new rear port instead.
  7. According to the WebUI, front port and new rear port are now properly connected to each other, and the other devices:
    Image
    Image
  8. However, tracing the front port ends at the original rear port, that original rear port's Trace button is (correctly) disabled, and tracing the new rear port gives an empty result:
    Image
    Image
  9. Final step: Delete the original rear port from the test patchpanel ...
  10. ... and tracing the front(!) port now gives an empty picture showing, upon "download SVG", the ZeroDivisionError:
    Image
    Image
    (Tracing the new rear port still yields the "no paths found" result ... for whatever reason.)

Looks to me like the WebUI is aware of the front port having been reconnected to the new rear port, but the tracing mechanism still proceeds to the old one, as long as that one exists, and errs out when that one has been deleted ...

@bin-bern commented on GitHub (May 27, 2025): It seems that I can reproduce the bug in a simpler setting (and with somewhat different symptoms): 0. Log in to demo.netbox.dev and pick a rack that already has a switch and a patchpanel. (I chose "Comms closet" at Site "DM-Yonkers", with switch "dmi01-yonkers-sw01" and patchpanel "48-Port Patch Panel".) 1. Create a new device type, add a rear port with one(!) position, type 8P8C, then a front port of the same type, connected to the rear port('s single position). 2. Create a new device of that type, role "Patch Panel", and put it into the chosen rack. 3. Connect the front port to an interface of the switch, and the rear port to a rear port of the other patchpanel, creating two new cables and activating the ports' "Trace" buttons in the process. 4. (Doing a trace shows a chain from the switch through its port, the test panel's front- and original rear port, and the other panel's rear port to its front port:) ![Image](https://github.com/user-attachments/assets/ad8b8b23-f7d9-45b0-9323-582a919d568c) 5. Add a new (single-position) rear port to the test device, edit the front port to connect to the new rear port instead, edit the cable to the other patch panel to connect it to the new rear port instead. 6. According to the WebUI, front port and new rear port are now properly connected to each other, and the other devices: ![Image](https://github.com/user-attachments/assets/0f3431ed-7954-4288-adb8-4b7c106b0961) ![Image](https://github.com/user-attachments/assets/7fa31fc8-c26b-4474-a1fb-c04d3e181060) 7. However, tracing the front port ends at the **original** rear port, that original rear port's Trace button is (correctly) disabled, and tracing the new rear port gives an empty result: ![Image](https://github.com/user-attachments/assets/fcf53c21-40a9-49a5-947d-81b01ecf9026) ![Image](https://github.com/user-attachments/assets/b1fc4e3c-2978-429e-98ae-4274613df2dd) 8. Final step: Delete the original rear port from the test patchpanel ... 9. ... and tracing the front(!) port now gives an empty picture showing, upon "download SVG", the ZeroDivisionError: ![Image](https://github.com/user-attachments/assets/614897d6-5438-4337-93a6-c67fcbeef79a) ![Image](https://github.com/user-attachments/assets/19ab80ce-9f2b-4f86-b5bd-648856265785) (Tracing the new rear port still yields the "no paths found" result ... for whatever reason.) Looks to me like the WebUI is aware of the front port having been reconnected to the _new_ rear port, but the tracing mechanism still proceeds to the _old_ one, as long as that one exists, and errs out when that one has been deleted ...
Author
Owner

@github-actions[bot] commented on GitHub (Aug 27, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 27, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Sep 27, 2025):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Sep 27, 2025): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11218