[
https://issues.apache.org/jira/browse/PLC4X-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17105441#comment-17105441
]
Christofer Dutz commented on PLC4X-197:
---------------------------------------
This issue only seems to apply to 0.6.0 (and before that) ... could you please
check the 0.7.0-SNAPSHOT version as we are planning on cutting a new release in
1-2 days. It the problem persists, we should fix that.
> tcp connection issue: Static Timer stopped when multiple tcpconnections
> -----------------------------------------------------------------------
>
> Key: PLC4X-197
> URL: https://issues.apache.org/jira/browse/PLC4X-197
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Core, Driver-Modbus
> Affects Versions: 0.6.0
> Reporter: minchengbo
> Priority: Critical
> Attachments: testcase.java
>
>
> NettyPlcConnection creates a staitc timer, this timer may be closed in
> SingleItemToSingleRequestProtocol, and then the other NettyPlcConnection will
> get ExecutionException:
> Caused by: java.lang.IllegalStateException: cannot be started once
> stoppedCaused by: java.lang.IllegalStateException: cannot be started once
> stopped at io.netty.util.HashedWheelTimer.start(HashedWheelTimer.java:350) at
> io.netty.util.HashedWheelTimer.newTimeout(HashedWheelTimer.java:429) at
> org.apache.plc4x.java.base.protocol.SingleItemToSingleRequestProtocol.write(SingleItemToSingleRequestProtocol.java:288)
> /////////////////NettyPlcConnection.java
> public abstract class NettyPlcConnection extends AbstractPlcConnection {
> /**
> * a \{@link HashedWheelTimer} shall be only instantiated once.
> */
> // TODO: maybe find a way to make this configurable per jvm
> protected final static Timer timer = new HashedWheelTimer();
> protected final ChannelFactory channelFactory;
> ///////////////////////////////// SingleItemToSingleRequestProtocol.java
> @Override
> public void channelInactive(ChannelHandlerContext ctx) throws Exception {
> // Send everything so we get a proper failure for those pending writes
> this.queue.removeAndWriteAll();
> this.timer.stop();
> this.scheduledTimeouts.clear();
> this.sentButUnacknowledgedSubContainer.clear();
> this.correlationToParentContainer.clear();
> this.containerCorrelationIdMap.clear();
> this.responsesToBeDelivered.clear();
> this.correlationIdGenerator.set(0);
> this.deliveredItems.set(0);
> this.erroredItems.set(0);
> this.deliveredContainers.set(0);
> this.erroredContainers.set(0);
> super.channelInactive(ctx);
> }
--
This message was sent by Atlassian Jira
(v8.3.4#803005)