Skip to content

Commit 304f37d

Browse files
maniac103lsiepel
authored andcommitted
[yamahareceiver] Fix read stall blocking OH thing handler thread pool (openhab#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 openhab#17768 Signed-off-by: Danny Baumann <[email protected]>
1 parent 8b2bbfe commit 304f37d

File tree

1 file changed

+2
-0
lines changed
  • bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml

1 file changed

+2
-0
lines changed

bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class XMLConnection extends AbstractConnection {
4747
private static final String HEADER_CHARSET_PART = "charset=";
4848

4949
private static final int CONNECTION_TIMEOUT_MS = 5000;
50+
private static final int READ_TIMEOUT_MS = 3000;
5051

5152
public XMLConnection(String host) {
5253
super(host);
@@ -77,6 +78,7 @@ private <T> T postMessage(String prefix, String message, String suffix,
7778

7879
// Set a timeout in case the device is not reachable (went offline)
7980
connection.setConnectTimeout(CONNECTION_TIMEOUT_MS);
81+
connection.setReadTimeout(READ_TIMEOUT_MS);
8082

8183
connection.setUseCaches(false);
8284
connection.setDoInput(true);

0 commit comments

Comments
 (0)