From: Mathieu Desnoyers Date: Thu, 23 Apr 2020 16:51:40 +0000 (-0400) Subject: Fix: agent: read: end of loop condition should exclude 0 X-Git-Tag: v2.12.1~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=45baa5bd32a4fda372de2bec6b5acca2958a2ab0;p=lttng-ust.git Fix: agent: read: end of loop condition should exclude 0 Causes the agent to hang endlessly waiting for completion of the loop. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java index 0e7a5c18..c6385005 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java @@ -387,7 +387,7 @@ public class LttngTcpSessiondClient implements Runnable { int bytesLeft = data.length; int bytesOffset = 0; - while (bytesLeft >= 0) { + while (bytesLeft > 0) { int bytesRead = this.inFromSessiond.read(data, bytesOffset, bytesLeft); if (bytesRead < 0) { @@ -416,7 +416,7 @@ public class LttngTcpSessiondClient implements Runnable { return null; } - while (bytesLeft >= 0) { + while (bytesLeft > 0) { int bytesRead = inFromSessiond.read(payload, bytesOffset, bytesLeft); if (bytesRead < 0) {