[
https://issues.apache.org/jira/browse/PLC4X-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Otto Fowler updated PLC4X-197:
------------------------------
Priority: Blocker (was: Critical)
> 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
> Assignee: Otto Fowler
> Priority: Blocker
> 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)