You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Dirk Lorenz <d....@lorenz-software.net> on 2022/11/26 12:42:41 UTC

PLC4J API Bug (possibly in PlcDriverManager)

Hi guys,

I have been playing around with using PLC4J (v0.9.1, v0.10.0) to connect 
to a Beckhoff PLC in Java when I realized that my program never finishes.

After a little time debugging I saw that during destruction not all 
threads are being terminated causing the program to starve.

All those remaining threads are somehow connected to the thread pool.

I explicitly called close on the connection and set all objects to NULL 
without any effect.
Moreover, I'm missing a method on the driver manager to retrieve or to 
close all connections.

At that point I'm pretty stuck with this problem and the only option 
would be to dive deep into implementation of the library.

I haven't been cross checking if the problem also occurs with a S7 
connection. But since this code (using DefaultNettyPlcConnection) is 
pretty generic and not specific to the driver I believe this is a 
general issue.
But I could also be wrong and it could be related to some missing code 
in AdsProtocolLogic.


Attached to the mail I'm sending the debug log file. On request I can 
send you the Java project, too.

Regards
Dirk

-- 

Re: PLC4J API Bug (possibly in PlcDriverManager)

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Dirk,

First, of all: Welcome to the coolest list Apache has to offer :-)
I hope this is going to be the start of a great journey, with us :-)

I had to moderate your email through, as it seems you are not subscribed to this list … please do so, by sending an empty email to dev-subscribe@plc4x.apache.org<ma...@plc4x.apache.org> so you can get all the other replies.

Now to your question:
The problem is, if you have a pooled connection and you call close on that, it doesn’t close the connection, but puts it back into the pool/cache.

I think there usually was something to close down the pool, but it’s been quite some time since I worked with the Java part of PLC4X (Well … worked WITH it … I sort of work ON it all the time ;-))

I hope someone else on the list will be able to help you. And if the help is, telling you it currently doesn’t work. We’ll do everything we can to, help you fix it yourself or perhaps someone already knows how to fix it.


Chris

From: Dirk Lorenz <d....@lorenz-software.net>
Date: Saturday, 26. November 2022 at 16:01
To: dev@plc4x.apache.org <de...@plc4x.apache.org>
Subject: PLC4J API Bug (possibly in PlcDriverManager)

Hi guys,

I have been playing around with using PLC4J (v0.9.1, v0.10.0) to connect to a Beckhoff PLC in Java when I realized that my program never finishes.

After a little time debugging I saw that during destruction not all threads are being terminated causing the program to starve.

[cid:part1.uph6LffY.JH051bCl@lorenz-software.net]

All those remaining threads are somehow connected to the thread pool.

I explicitly called close on the connection and set all objects to NULL without any effect.
Moreover, I'm missing a method on the driver manager to retrieve or to close all connections.

At that point I'm pretty stuck with this problem and the only option would be to dive deep into implementation of the library.

I haven't been cross checking if the problem also occurs with a S7 connection. But since this code (using DefaultNettyPlcConnection) is pretty generic and not specific to the driver I believe this is a general issue.
But I could also be wrong and it could be related to some missing code in AdsProtocolLogic.

[cid:part2.YCQEVZV0.5GsFVSgR@lorenz-software.net]
Attached to the mail I'm sending the debug log file. On request I can send you the Java project, too.

Regards
Dirk
--
[cid:part3.bHQYSzUw.9QDhELr7@lorenz-software.net]