# Gateway crashing when trying to open serial port

**URL:** <https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847>\
**Category:** Ignition\
**Created:** [July 14, 2021, 7:06pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847 "2021-07-14T19:06:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.keefe](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kevin.keefe](https://forum.inductiveautomation.com/u/kevin.keefe)\
**Post date:** [July 14, 2021, 7:06pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/1 "2021-07-14T19:06:44Z")

</div>

Hi

I’m having an issue with a system that I’m playing around with. I’m trying to read from a serial port via a tag change gateway script, but every time i try to open it the gateway is crashing.  
Gateway version 8.1.7 (b2021060314)

Looking at the wrapper log all I can see is :

INFO | jvm 2 | 2021/07/14 19:40:01 | I [p.DesignSession] [18:40:01]: Socket connected to session. pageId=session-props session-project=Weighing\_Room  
ERROR | wrapper | 2021/07/14 19:42:02 | JVM exited unexpectedly.  
STATUS | wrapper | 2021/07/14 19:42:07 | Reloading Wrapper configuration…  
STATUS | wrapper | 2021/07/14 19:42:08 | Launching a JVM…  
INFO | jvm 3 | 2021/07/14 19:42:08 | WrapperManager: Initializing…

I have tried using the system.serial. port script strait from the users manual, but it still does the same thing.

**with system.serial.port(**  
\*\* port = “COM3”,\*\*  
\*\* bitRate = system.serial.BIT\_RATE\_9600,\*\*  
\*\* dataBits = system.serial.DATA\_BITS\_8,\*\*  
\*\* handshake = system.serial.HANDSHAKE\_NONE,\*\*  
\*\* hardwareFlowControl = False,\*\*  
\*\* parity = system.serial.PARITY\_NONE,\*\*  
\*\* stopBits = system.serial.STOP\_BITS\_1) as port:\*\*

* * *

\*\* line = port.readLine(60000)\*\*

Any thoughts?

Kev

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 14, 2021, 7:10pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/2 "2021-07-14T19:10:34Z")

</div>

What OS/version is the Ignition Gateway running on?

---

<div class="post-metadata">

**Author:** ![kevin.keefe](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kevin.keefe](https://forum.inductiveautomation.com/u/kevin.keefe)\
**Post date:** [July 14, 2021, 7:17pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/3 "2021-07-14T19:17:07Z")

</div>

Hi Kevin

Server 2016 Standard.  
Version 1607  
OS Build 14393.4169

Kev

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 14, 2021, 7:40pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/4 "2021-07-14T19:40:36Z")

</div>

Are there any crash dump files in the Ignition install dir or nearby? Probably named hs\_err\_pid something…

---

<div class="post-metadata">

**Author:** ![kevin.keefe](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kevin.keefe](https://forum.inductiveautomation.com/u/kevin.keefe)\
**Post date:** [July 14, 2021, 7:54pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/5 "2021-07-14T19:54:06Z")

</div>

No crash dump files at all 😬

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 14, 2021, 8:05pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/6 "2021-07-14T20:05:40Z")

</div>

I thought the `with` (context manager) syntax for `system.serial.port()` was broken at the moment. Try without using it as a context manager.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 14, 2021, 8:47pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/7 "2021-07-14T20:47:47Z")

</div>

The issues with context manager should have been fixed in 8.1.3, though @ggross is still seeing something weird going on with it.

@kevin.keefe Not sure what’s going on with your crash though. We’re unable to reproduce on Server 2016 here.

---

<div class="post-metadata">

**Author:** ![ggross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ggross/32/12668_2.png) [@ggross](https://forum.inductiveautomation.com/u/ggross)\
**Post date:** [July 14, 2021, 8:59pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/8 "2021-07-14T20:59:18Z")

</div>

Issues I was seeing with the context manager were user error. It looks like it is working as expected in the 8.1.3+.

@kevin.keefe is there anything else within Ignition that might be connecting to the same serial port? Also, is Windows Device Manager showing everything being ok with the COM port?

Garth

---

<div class="post-metadata">

**Author:** ![kevin.keefe](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kevin.keefe](https://forum.inductiveautomation.com/u/kevin.keefe)\
**Post date:** [July 14, 2021, 9:19pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/9 "2021-07-14T21:19:17Z")

</div>

Garth

All looks fine with the COM port.  
As far as I can see, there is nothing else connecting to that specific serial port.

@Kevin.Herron : I’ll format & reinstall the OS tomorrow to see if anything changes

I’ve just noticed that the serial port monitor that i use is now playing up. Not sure if that is connected

Kev

---

<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:** [July 14, 2021, 10:19pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/10 "2021-07-14T22:19:27Z")

</div>

Anything in Windows’ Event Viewer logs after you restart?

---

<div class="post-metadata">

**Author:** ![kevin.keefe](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kevin.keefe](https://forum.inductiveautomation.com/u/kevin.keefe)\
**Post date:** [July 15, 2021, 6:11am UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/11 "2021-07-15T06:11:21Z")

</div>

This is whats showning up in the Windows Event Viewer when the issue occurs:

Faulting application name: java.exe, version: 11.48.0.22, time stamp: 0x6069e9a2  
Faulting module name: ntdll.dll, version: 10.0.14393.3986, time stamp: 0x5f77fd0d  
Exception code: 0xc00000fd  
Fault offset: 0x000000000002e7cd  
Faulting process id: 0x2f90  
Faulting application start time: 0x01d778f4c042846d  
Faulting application path: C:\Program Files\Inductive Automation\Ignition\lib\runtime\jre-win\bin\java.exe  
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll  
Report Id: 9d96e27b-02c2-4044-8b2b-2afbb2b7fb65  
Faulting package full name:  
Faulting package-relative application ID

---

<div class="post-metadata">

**Author:** ![fadihindi](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@fadihindi](https://forum.inductiveautomation.com/u/fadihindi)\
**Post date:** [March 1, 2022, 8:57pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/12 "2022-03-01T20:57:18Z")

</div>

I am having a similar issue with Ignition v7.9.16 by accessing the gateway serial port to read modbus data via a usb/RS485 adapter. The serial port is installed in Windows (Server 2019) properly, and a Modbus serial device is created on the gateway. Once I create a tag accessing this device, the gateway crashes. On restarting the gateway from the GCU it restarts and shows running and then crashes immediately and seems to enter a state where it is perpetually trying to do something (don’t know what), the status icon keeps refreshing, but doesn’t come back online. The only way I can restart it is by using the GCU to stop it completely, then manually delete the serial gateway module, then restart the gateway. If I don’t force stop the gateway I can’t delete the serial module as it is being used by java.exe. The serial client module does not have issues and I have used this successfully via the same gateway. This has been observed on multiple gateways so is not hardware specific (although all are similar Dell servers), and affects any type of serial port access on the gateway, modbus, ascii, etc.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 1, 2022, 10:22pm UTC](https://forum.inductiveautomation.com/t/gateway-crashing-when-trying-to-open-serial-port/48847/13 "2022-03-01T22:22:43Z")

</div>

Ignition v7.9.x implements serial port support via the jserial library. It is old and poorly maintained. For v8.x, they rewrote their implementation around the jSerial library. Which is well supported and maintained. In this situation, the default answer is “Upgrade Ignition”. Presumably to v8.1, so you’ll still be on a long-term supported version.

However, it so happens that I implemented my [Advanced Modbus Driver](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-advanced-modbus) with the jSerial library, even for v7.9. That might get you out of trouble.
