[ 
https://issues.apache.org/jira/browse/PLC4X-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17544273#comment-17544273
 ] 

Łukasz Dywicki commented on PLC4X-344:
--------------------------------------

Thank you Robin for pointing out issue. By looking at transaction manager I can 
see that there are more things than just that. We have explicit thread pool 
size of 4 which makes maximum concurrency level. While its more than enough for 
most of PLCs, it will get a conflict when request count specified for 
connection is higher than 4. Its executor is also static which means same 
thread pool will be used for all connections.

The tricky part for request transaction manager is a blocking an poll/write 
attempt when concurrency limit is reached, without managing thread pool queue 
itself. As far I remember there is a way to achieve similar effect with 
blocking queue, yet then whole request tracking we have built is to be removed. 
I think that we might simply swap request tracking with an atomic counter to 
get whole thing on safe side. In principle whole tracking of running requests 
could be avoided in favor of just counting active tasks.

> spi.transaction.RequestTransactionManager is not thread safe
> ------------------------------------------------------------
>
>                 Key: PLC4X-344
>                 URL: https://issues.apache.org/jira/browse/PLC4X-344
>             Project: Apache PLC4X
>          Issue Type: Bug
>          Components: Driver-S7, PLC4J
>         Environment: Siemens IOT 2050, debian. PLC4J via kotlin
>            Reporter: Robin
>            Priority: Major
>         Attachments: errorConnect.png
>
>
> When running a s7 connection to an PLC sometimes the connection halts and 
> this error is thrown in the log. It seems like the processWorklog function 
> uses a thread safe queue but is itself not threadsafe throwing this error.
>  
> We're using an single connection to the plc. Reading two datablocks. Each 
> datablock is read by a different handler running in a separate thread but 
> using the same instance of PLC4J.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to