From 304f37d470dc9c1bd014681b5d1387e30033f050 Mon Sep 17 00:00:00 2001 From: maniac103 Date: Tue, 19 Nov 2024 20:08:13 +0100 Subject: [PATCH] [yamahareceiver] Fix read stall blocking OH thing handler thread pool (#17769) Since no read timeout was set, reads blocked indefinitely, which in case of unreachable receiver led to blocking the OH thing handler thread pool, since multiple requests are launched into the thread pool simultaneously. Fixes #17768 Signed-off-by: Danny Baumann --- .../yamahareceiver/internal/protocol/xml/XMLConnection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java index e32f0de0148..0bff886cb22 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java @@ -47,6 +47,7 @@ public class XMLConnection extends AbstractConnection { private static final String HEADER_CHARSET_PART = "charset="; private static final int CONNECTION_TIMEOUT_MS = 5000; + private static final int READ_TIMEOUT_MS = 3000; public XMLConnection(String host) { super(host); @@ -77,6 +78,7 @@ public class XMLConnection extends AbstractConnection { // Set a timeout in case the device is not reachable (went offline) connection.setConnectTimeout(CONNECTION_TIMEOUT_MS); + connection.setReadTimeout(READ_TIMEOUT_MS); connection.setUseCaches(false); connection.setDoInput(true);