Skip to content

Commit

Permalink
[yamahareceiver] Fix read stall blocking OH thing handler thread pool (
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
maniac103 authored and matchews committed Dec 16, 2024
1 parent c5b0f9e commit 1d0a094
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -77,6 +78,7 @@ private <T> T postMessage(String prefix, String message, String suffix,

// 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);
Expand Down

0 comments on commit 1d0a094

Please sign in to comment.