takraj opened a new issue, #1100: URL: https://github.com/apache/plc4x/issues/1100
### What happened? OPC-UA connections get dead after session timeout, which is hard-coded to 2 minutes in the driver. After this timeout, any request made with this connection object fails with `INTERNAL_ERROR`. In case of subscriptions, an even worse `ClassCastException` gets thrown internally, complaining about being unable to cast a `ServiceFault` to a response object, and because of this, the future object earlier returned by `request.execute()` never get completed. This is especially a problem when using `plc4j-connection-pool`, which keeps a set of connection objects open, and thus users of the pool might get these dead connections. The session timeout value is hard-coded in [SecureChannel.java:400](https://github.com/apache/plc4x/blob/cac8254518540d6353546fcf7619203e2f64e721/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java#L400) Simplest code to reproduce the issue: ``` PlcDriverManager driverManager = new PlcDriverManager(); try (PlcConnection opcuaConnection = driverManager.getConnection("opcua:tcp://opcuaserver.com:48010")) { PlcReadRequest request = opcuaConnection.readRequestBuilder() .addItem( "Demo", "ns=2;s=Demo.Static.Scalar.String" ) .build(); PlcReadResponse response1 = request.execute().get(); System.out.println("RESPONSE 1: " + response1.getObject("Demo")); Thread.sleep(3 * 60 * 1000); // 3 minutes PlcReadResponse response2 = request.execute().get(); System.out.println("RESPONSE 2: " + response2.getObject("Demo")); } ``` Expected behavior would be to transparently recover from the error, and to create a new session internally. ### Version v0.10.0 ### Programming Languages - [X] plc4j - [ ] plc4go - [ ] plc4c - [ ] plc4net ### Protocols - [ ] AB-Ethernet - [ ] ADS /AMS - [ ] BACnet/IP - [ ] CANopen - [ ] DeltaV - [ ] DF1 - [ ] EtherNet/IP - [ ] Firmata - [ ] KNXnet/IP - [ ] Modbus - [X] OPC-UA - [ ] S7 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@plc4x.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org