Report killed during execution #2919

Closed
opened 2025-12-29 18:23:25 +01:00 by adam · 5 comments
Owner

Originally created by @henyxia on GitHub (Sep 30, 2019).

Environment

  • Python version:
  • NetBox version:

Steps to Reproduce

  1. Launch this report in CLI:
# python3 /opt/netbox/netbox/manage.py runreport rack-reports.DeviceRackingReport -v3
[19:30:29] Running rack-reports.DeviceRackingReport...
Killed

The report is the following:

from dcim.constants import *
from dcim.models import Device, Rack, RackGroup
from extras.reports import Report
from ipam.constants import *

class DeviceRackingReport(Report):
    description = "Verify each device is assigned to a Rack"
    def test_device_racking(self):
        for device in Device.objects.filter(status=DEVICE_STATUS_ACTIVE):
            if device.rack_id is not None:
                if device.position is not None:
                    self.log_success(device)

                elif device.device_type.is_child_device:
                    self.log_info(device, "Device is child device and therefore not racked itself")
                else:
                    self.log_warning(device, "Device is racked, but not assigned a position")
            else:
                self.log_failure(device, "Device is not racked")

Expected Behavior

I expected the report to be done.

Observed Behavior

The command is killed.
I precise that this is not an OOM killed and we have around 100k devices.

Originally created by @henyxia on GitHub (Sep 30, 2019). ### Environment * Python version: <!-- Example: 3.7.4 --> * NetBox version: <!-- Example: 2.6.5 --> ### Steps to Reproduce 1. Launch this report in CLI: ``` # python3 /opt/netbox/netbox/manage.py runreport rack-reports.DeviceRackingReport -v3 [19:30:29] Running rack-reports.DeviceRackingReport... Killed ``` The report is the following: ``` from dcim.constants import * from dcim.models import Device, Rack, RackGroup from extras.reports import Report from ipam.constants import * class DeviceRackingReport(Report): description = "Verify each device is assigned to a Rack" def test_device_racking(self): for device in Device.objects.filter(status=DEVICE_STATUS_ACTIVE): if device.rack_id is not None: if device.position is not None: self.log_success(device) elif device.device_type.is_child_device: self.log_info(device, "Device is child device and therefore not racked itself") else: self.log_warning(device, "Device is racked, but not assigned a position") else: self.log_failure(device, "Device is not racked") ``` ### Expected Behavior I expected the report to be done. ### Observed Behavior The command is killed. I precise that this is not an OOM killed and we have around 100k devices.
adam closed this issue 2025-12-29 18:23:25 +01:00
Author
Owner

@kobayashi commented on GitHub (Oct 3, 2019):

I can run the script.

bash-5.0# python3 /opt/netbox/netbox/manage.py runreport rack-reports.DeviceRackingReport -v3       
[03:08:32] Running rack-reports.DeviceRackingReport...                                              
        test_device_racking: 1 success, 0 info, 1 warning, 1 failure                                
[03:08:32] rack-reports.DeviceRackingReport: FAILED                                                 
[03:08:32] Finished

Is this only for the script? Or other's also?
You might be able to check your environment with a sample script in netbox docs

@kobayashi commented on GitHub (Oct 3, 2019): I can run the script. ``` bash-5.0# python3 /opt/netbox/netbox/manage.py runreport rack-reports.DeviceRackingReport -v3 [03:08:32] Running rack-reports.DeviceRackingReport... test_device_racking: 1 success, 0 info, 1 warning, 1 failure [03:08:32] rack-reports.DeviceRackingReport: FAILED [03:08:32] Finished ``` Is this only for the script? Or other's also? You might be able to check your environment with a sample script in [netbox docs](https://netbox.readthedocs.io/en/stable/additional-features/reports/)
Author
Owner

@henyxia commented on GitHub (Oct 3, 2019):

It is the only script but I think the issue might be linked to the item quantity (in our case, around 100k).
Other scripts are working well, but they are using objects with less items (around 2k).

@henyxia commented on GitHub (Oct 3, 2019): It is the only script but I think the issue might be linked to the item quantity (in our case, around 100k). Other scripts are working well, but they are using objects with less items (around 2k).
Author
Owner

@kobayashi commented on GitHub (Oct 5, 2019):

OK, this is not netbox bugs. Can you try to change your own reports script. For your scirpt, mailing list should be helpful!

@kobayashi commented on GitHub (Oct 5, 2019): OK, this is not netbox bugs. Can you try to change your own reports script. For your scirpt, [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss) should be helpful!
Author
Owner

@jeremystretch commented on GitHub (Oct 7, 2019):

Yeah, it looks like you're just running into a limitation on the WSGI process lifetime. Can't do much about this unfortunately until we implement the ability to run scripts and reports in a background process (see #2006).

@jeremystretch commented on GitHub (Oct 7, 2019): Yeah, it looks like you're just running into a limitation on the WSGI process lifetime. Can't do much about this unfortunately until we implement the ability to run scripts and reports in a background process (see #2006).
Author
Owner

@henyxia commented on GitHub (Oct 8, 2019):

Ok, thanks for the information :)

@henyxia commented on GitHub (Oct 8, 2019): Ok, thanks for the information :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2919