Closed DmitriiMukhin closed 1 year ago
Can you try my resp https://github.com/spnettec/plc4x.git? heyoulin branch. If no problem i will cretae a pull request.
@heyoulin Thank you - great job. I think this part of your solution helped me.
pipeline.addLast(new ChannelInboundHandlerAdapter() {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
throws PlcConnectionException {
logger.error("unknown error, close the connection", cause);
close();
}
}
);
I've tested for a while - at first glance it works. Abandoned(parked) threads are absent. Connection is establishing as it should in normal situation, I mean when controller is accessible. I'll continue testing.
I'll be forced to fork 0.10.0 release to our company repo with such fix. As we don't know when new fixed release will be published.
@heyoulin Thank you - great job. I think this part of your solution helped me.
pipeline.addLast(new ChannelInboundHandlerAdapter() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws PlcConnectionException { logger.error("unknown error, close the connection", cause); close(); } } );
I've tested for a while - at first glance it works. Abandoned(parked) threads are absent. Connection is establishing as it should in normal situation, I mean when controller is accessible. I'll continue testing.
I'll be forced to fork 0.10.0 release to our company repo with such fix. As we don't know when new fixed release will be published.
I was wrong. All code changes are needed.
Is this issue still open or has it been fixed?
Is this issue still open or has it been fixed?
It could be fixed with provided PR. Such fix was tested in our local company fork. No more issues.
Ok ... as I've merged that PR, I'll close this issue, right?
What happened?
When s7 driver can't establish connection with controller it creates threads that being falling into park state TIMED_WAITING. While application keep trying to connect via PlcDriverManger.getConnection(url) such threads count continuously growing. In the end we have java.lang.OutOfMemoryError: unable to create native thread.
We are using s7 driver to communicate with different controllers from single app.
Screenshots just to demonstrate an issue. Driver creates thousands of such threads.
Version
v0.10.0
Programming Languages
Protocols