# Gateway Crash and Restart after Report Execute Script

**URL:** <https://forum.inductiveautomation.com/t/gateway-crash-and-restart-after-report-execute-script/74030>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 22, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/gateway-crash-and-restart-after-report-execute-script/74030 "2023-05-22T16:16:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 22, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/gateway-crash-and-restart-after-report-execute-script/74030/1 "2023-05-22T16:16:28Z")

</div>

v8.1.27

I just ran into a really weird gateway issue right after I tested a simple script to print a report. Below is the button `onActionPerformed` script.

I tested it, and I noticed the gateway immediately restart. I didn't realize that this script was the "problem" until it restarted the gateway again the next time, I tested it. I tried the same script on another gateway that is mirrored to the one that restarts, and it runs perfect and the gateway doesn't restart.

```auto
def runAction(self, event):
	plant = self.session.custom.plant
	department = self.view.params.department
	user = self.getSibling("User").props.value
	
	printer = 'P1Engineer'
	
#	if plant == 1:
# if department == 'sewing':
# printer = 'P1Sewing'
# elif department == 'staging':
# printer = 'P1Staging'
#	elif plant == 5:
# printer = 'P5Office'
	
	system.report.executeAndDistribute(
		path='Employee_Label', 
		action = 'print', 
		actionSettings = {'primaryPrinterName':printer, 'copies':1}
	)
		
	self.getSibling("Result").props.text = 'Sent to %s' % printer
	
	self.getSibling("Cancel").meta.visible = False
	self.getSibling("Confirm").meta.visible = False

```

The last time I tried the script which forced a restart, the gateway has no logs until it starts to start up again. I have never seen this happen, and it is very strange.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 22, 2023, 4:32pm UTC](https://forum.inductiveautomation.com/t/gateway-crash-and-restart-after-report-execute-script/74030/2 "2023-05-22T16:32:09Z")

</div>

My guess would be the report is the problem; depending on your version there could be some bugs where a 'bad' report could end up growing to infinite (or thousands) of pages and instantly sucking up a lot of memory, only to be killed by the OS ungracefully. There may be `hs_err.pid.log` files in the Ignition install directory with more info.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 22, 2023, 7:09pm UTC](https://forum.inductiveautomation.com/t/gateway-crash-and-restart-after-report-execute-script/74030/3 "2023-05-22T19:09:58Z")

</div>

The funny thing though, is that I'm displaying the same report in a perspective report viewer with no issues. The report has a single query that returns a single row, and I've been using it for months and has not been changed.

The report executes and prints fine, then the gateway restarts afterwards. Works perfect on the other gateway, so it doesn't seem easily reproducible. I do have an hs\_err.pid.log file in my install directory, I guess I should contact support.
