From 45baa5bd32a4fda372de2bec6b5acca2958a2ab0 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 23 Apr 2020 12:51:40 -0400 Subject: [PATCH] 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 --- .../org/lttng/ust/agent/client/LttngTcpSessiondClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) { -- 2.34.1