Julian Feinauer created PLC4X-139:
-------------------------------------
Summary: PLC4X leaks sockets in case of connection problems
Key: PLC4X-139
URL: https://issues.apache.org/jira/browse/PLC4X-139
Project: Apache PLC4X
Issue Type: Bug
Components: Core
Affects Versions: 0.4.0
Reporter: Julian Feinauer
Assignee: Julian Feinauer
See my description on the list:
https://lists.apache.org/thread.html/4aa229421668a92275e33643dbc57f2fea29cee7ffcb07891f58c9eb@%3Cdev.plc4x.apache.org%3E
I created a MWE like that
{code:java}
public static void main(String[] args) throws Exception {
IntStream.range(0, 100).parallel().forEach(i -> createConnection(i));
}
private static void createConnection(int i) {
System.out.println("trying " + i);
try (PlcConnection plcConnection = new
PlcDriverManager().getConnection("s7://192.168.167.211/0/0")) {
} catch (Exception e) {
logger.error("Kann keine Verbindung zu der angegebenen Adresse
aufbauen");
}
}
{code}
where the IP is *not reachable*, thus it fails every time.
When looking at the open sockets with (works on my Mac)
{code:bash}
while true; do lsof -p 16843 | wc -l; sleep 10; done
{code}
I get the output
{noformat}
1640
1640
1640
1736
1736
1736
1832
1832
1832
1928
1928
1928
2024
2024
2024
2120
2120
2120
2216
2216
2216
2312
2312
2312
2408
2408
2408
2504
2504
2504
2500
{noformat}
So this reall sems to be the case.
I think this could be due to us only propagating the exception but not closing
the channel, I will investigate further.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)