[ 
https://issues.apache.org/jira/browse/PLC4X-245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187636#comment-17187636
 ] 

Turker TUNALI commented on PLC4X-245:
-------------------------------------

The device is a [power consumption analyser|https://www.entes.eu/mpr-32/]. 

I've tried a few more times and I could read values 2 times with 10sec 
interval, 37 and 44 times with 2 sec interval. So read count changes over time. 

Then I tried it with Node-RED. It also get errors but it waits for 2 seconds 
and then reconnects. So they've implemented a logic for such failures.

I've tried that logic with NiFi but "Plc4xSourceProcessor" can't have an input 
connection so I couldn't use the "RetryFlowFile" processor. (An example is 
[here|https://link.medium.com/HndIj32Fo9])

I am not sure if this should be handled in the processor like Node-RED or 
Plc4xSourceProcesor should take input processor so we can implement it manually.

End I also experiment that if something fails, like exception is thrown, 
Plc4xSourceProcesor doesn't send flow file to the "Failure" connection.

So for now, NiFi don't send flow files to failure connection when it has 
troubles, can't get input connection to retry it. I will look at the source 
file but it would be better if we could find a NiFi guy. I will also ask in the 
NiFi forum.

 

Turker

> [Modbus] Apache NiFi processor throws java.io.IOException after a while
> -----------------------------------------------------------------------
>
>                 Key: PLC4X-245
>                 URL: https://issues.apache.org/jira/browse/PLC4X-245
>             Project: Apache PLC4X
>          Issue Type: Bug
>          Components: Driver-Modbus, Integration-NiFi
>    Affects Versions: 0.7.0
>         Environment: Apache NiFi 1.12.0, Win2012 Server, PLX4X Nar 0.7.0 
> (https://mvnrepository.com/artifact/org.apache.plc4x/plc4j-nifi-plc4x-nar/0.7.0)
>            Reporter: Turker TUNALI
>            Priority: Major
>         Attachments: modbustrace_200828.pcapng, modbustrace_200828_4.pcapng
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> My Plc4xSourceProcessor's, PLC connection String is 
> "modbus:tcp://[10.0.2.238:502?slave=1|http://10.0.2.238:502/?slave=1]"; and 
> PLC resource address String is "test1=holding-register:1"
>   
>  I can get the values for 5-10 times with 5 second intervals but then I get 
> below exception. I can read the values with the Modbus Poll application, so 
> most probably the PLC4X side has a problem.
>   
>  I may also get some other exceptions when starting the processor, which are 
> also below.
>   
> PS: Wireshark trace is attached. I've read 16 times then I get the exception.
>   
>  * 
>  -- This is the exception which I get after some successful read operations.*
>  2020-08-27 13:19:06,091 WARN [nioEventLoopGroup-8-1] 
> io.netty.channel.DefaultChannelPipeline An exceptionCaught() event was fired, 
> and it reached at the tail of the pipeline. It usually means the last handler 
> in the pipeline did not handle the exception.
>  java.io.IOException: An existing connection was forcibly closed by the 
> remote host
>  at sun.nio.ch.SocketDispatcher.read0(Native Method)
>  at sun.nio.ch.SocketDispatcher.read(Unknown Source)
>  at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
>  at sun.nio.ch.IOUtil.read(Unknown Source)
>  at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
>  at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
>  at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
>  at 
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
>  at 
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>  at 
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
>  at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
>  at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
>  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>  at 
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>  at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>  at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>  at java.lang.Thread.run(Unknown Source)
>   
>   
>  -- This is the exception which I get sometimes when starting up the 
> processor.*
>  2020-08-27 13:17:16,813 WARN [Timer-Driven Process Thread-11] 
> o.a.n.controller.tasks.ConnectableTask Administratively Yielding 
> Plc4xSourceProcessor[id=2f12f5b4-0174-1000-724e-a53ba0fc1652] due to uncaught 
> Exception: java.lang.NullPointerException
>  java.lang.NullPointerException: null
>  at 
> org.apache.plc4x.nifi.Plc4xSourceProcessor.onTrigger(Plc4xSourceProcessor.java:50)
>  at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>  at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1174)
>  at 
> org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
>  at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
>  at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
>  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>  at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
>  at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown
>  Source)
>  at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
>  Source)
>  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>  at java.lang.Thread.run(Unknown Source)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to