# RFID driver : error at first read after startup of the device (connection lost)

**URL:** <https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [August 29, 2023, 8:37am UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496 "2023-08-29T08:37:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane\_Boneff](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Stephane\_Boneff](https://forum.inductiveautomation.com/u/Stephane_Boneff)\
**Post date:** [August 29, 2023, 8:37am UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/1 "2023-08-29T08:37:30Z")

</div>

Hello,

I need to fix an RFID chip read/write application (sick rfu630).  
After each start of the RFID reader, the first reading always fails.  
I see then the following error in the gateway:

```auto
	Exception caught; connection lost.
java.io.IOException: An existing connection was forcibly closed by the remote host
at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.read(Unknown Source)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at java.base/sun.nio.ch.IOUtil.read(Unknown Source)
at java.base/sun.nio.ch.IOUtil.read(Unknown Source)
at java.base/sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

```

From the second reading the problem disappears.

But the problem also appears when the RFID reader is not used for a few hours.

Any idea ?

Thanks !

---

<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:** [August 29, 2023, 12:02pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/2 "2023-08-29T12:02:38Z")

</div>

> [@Stephane\_Boneff](#):
>
> `An existing connection was forcibly closed by the remote host`

That means the reader itself is to blame. Search its documentation for timeouts or power-saving modes or similar behaviors that might cause it to cut off Ignition's connection.

---

<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:** [August 29, 2023, 12:18pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/3 "2023-08-29T12:18:53Z")

</div>

Are you using the TCP driver to communicate with it?

---

<div class="post-metadata">

**Author:** ![Stephane\_Boneff](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Stephane\_Boneff](https://forum.inductiveautomation.com/u/Stephane_Boneff)\
**Post date:** [August 29, 2023, 12:24pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/4 "2023-08-29T12:24:58Z")

</div>

> [@pturmel](#):
>
> rea

yes

---

<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:** [August 29, 2023, 12:29pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/5 "2023-08-29T12:29:50Z")

</div>

The TCP driver has an "Inactivity Timeout" setting that you might try setting to something like 15 seconds.

---

<div class="post-metadata">

**Author:** ![Stephane\_Boneff](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Stephane\_Boneff](https://forum.inductiveautomation.com/u/Stephane_Boneff)\
**Post date:** [August 29, 2023, 1:37pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/6 "2023-08-29T13:37:14Z")

</div>

it was setted to 0. I change to 15000.  
Now, after the start, the problem no longer appears.  
I have to check after a long time without reading.  
I will do that tomorrow morning.

Thanks !

---

<div class="post-metadata">

**Author:** ![Stephane\_Boneff](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Stephane\_Boneff](https://forum.inductiveautomation.com/u/Stephane_Boneff)\
**Post date:** [August 29, 2023, 1:59pm UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/7 "2023-08-29T13:59:22Z")

</div>

the problem is still there.  
it just happened during my tests

---

<div class="post-metadata">

**Author:** ![Stephane\_Boneff](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Stephane\_Boneff](https://forum.inductiveautomation.com/u/Stephane_Boneff)\
**Post date:** [August 31, 2023, 6:53am UTC](https://forum.inductiveautomation.com/t/rfid-driver-error-at-first-read-after-startup-of-the-device-connection-lost/78496/8 "2023-08-31T06:53:23Z")

</div>

I made tests during one day : no more error on log, no more error at start of the device  
and after a long time without activity too.  
But I have some reading errors.  
I think it occurs during the reconnection (reconnection is display on GW log, reconnection and error occur at the same time).  
So I will try there settings :

- Inactivity Timeout : 30s
- increase timeout of the device.
