From 47fa3e4ed7ab43e034dc61fc1480f919f4ee51d0 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Tue, 28 Nov 2023 14:39:23 -0500 Subject: [PATCH] Fix java client connection path when LTTNG_UST_APP_PATH is set When LTTNG_UST_CTL_PATH is set for `lttng-sessiond`, the agent port is at `$LTTNG_UST_CTL_PATH/agent.port`, not `$LTTNG_UST_CTL_PATH/.lttng/agent.port`. Change-Id: I79419f36cbd802da06acd68f58e437b0d4eb3856 Signed-off-by: Kienan Stewart Signed-off-by: Mathieu Desnoyers --- .../org/lttng/ust/agent/client/LttngTcpSessiondClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java b/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java index 95376044..82f2c2f0 100644 --- a/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java +++ b/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java @@ -36,6 +36,7 @@ public class LttngTcpSessiondClient implements Runnable { private static final String SESSION_HOST = "127.0.0.1"; private static final String ROOT_PORT_FILE = "/var/run/lttng/agent.port"; private static final String USER_PORT_FILE = "/.lttng/agent.port"; + private static final String APP_PATH_PORT_FILE = "/agent.port"; private static final Charset PORT_FILE_ENCODING = Charset.forName("UTF-8"); private static final int PROTOCOL_MAJOR_VERSION = 2; @@ -179,7 +180,7 @@ public class LttngTcpSessiondClient implements Runnable { String lttngUstAppPath = getUstAppPath(); if (lttngUstAppPath != null) { - portToUse = getPortFromFile(lttngUstAppPath + USER_PORT_FILE); + portToUse = getPortFromFile(lttngUstAppPath + APP_PATH_PORT_FILE); } else { int rootPort = getPortFromFile(ROOT_PORT_FILE); int userPort = getPortFromFile(getHomePath() + USER_PORT_FILE); -- 2.34.1