From bc24acf4427d313b0aca16ac3f1e1abcf85e7e47 Mon Sep 17 00:00:00 2001 From: Serge Huber Date: Thu, 28 May 2026 09:03:51 +0200 Subject: [PATCH 1/3] UNOMI-937: Log poll failures in GraphQLListIT instead of swallowing them The keepTrying supplier caught all exceptions silently and returned null, so when polling timed out CI only showed the generic message with no root cause. Now we log e.getMessage() at WARN on each failed attempt so connection errors and parse failures are visible in CI logs. --- .../java/org/apache/unomi/itests/graphql/GraphQLListIT.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java index 139c19063..60a9a8507 100644 --- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java +++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java @@ -21,10 +21,14 @@ import org.apache.unomi.lists.UserList; import org.junit.Assert; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Objects; public class GraphQLListIT extends BaseGraphQLIT { + private static final Logger LOGGER = LoggerFactory.getLogger(GraphQLListIT.class); + @Test public void testCRUD() throws Exception { Profile persistedProfile = null; @@ -82,6 +86,7 @@ public void testCRUD() throws Exception { try (CloseableHttpResponse response = post("graphql/list/find-lists.json")) { return ResponseContext.parse(response.getEntity()); } catch (Exception e) { + LOGGER.warn("find-lists poll attempt failed: {}", e.getMessage()); return null; } }, From 6f9d284af951755468c672b2e211c9c825e0743c Mon Sep 17 00:00:00 2001 From: Serge Huber Date: Thu, 28 May 2026 10:33:06 +0200 Subject: [PATCH 2/3] UNOMI-937: Restore failing command in error output; show Maven stderr on version detection failure build.sh: handle_error was stripped of the failing command to avoid hitting ARG_MAX when $BASH_COMMAND expanded to a large mvn invocation. Reading BASH_COMMAND inside the function (instead of passing it through the trap) sidesteps the ARG_MAX issue while still printing the first 200 characters of the failing command, making CI failure triage easier. setenv.sh: mvn stderr was redirected to /dev/null to avoid capturing download noise into UNOMI_VERSION. On failure this silently discarded the actual error message. Stderr is now captured to a temp file and printed to stderr if version detection fails. --- build.sh | 6 +++++- setenv.sh | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index e6f1ae619..00d8dba3d 100755 --- a/build.sh +++ b/build.sh @@ -19,13 +19,16 @@ ################################################################################ set -e # Exit on error -# Keep trap arguments small: passing full $BASH_COMMAND can exceed ARG_MAX after a failed mvn invocation. trap 'handle_error $? $LINENO' ERR # Error handling function handle_error() { local exit_code=$1 local line_no=$2 + # Read BASH_COMMAND inside the function rather than passing it through the + # trap to avoid ARG_MAX limits after a failed mvn invocation; truncate to + # keep the output readable. + local failed_cmd="${BASH_COMMAND:0:200}" cat << "EOF" _____ ____ ____ ___ ____ @@ -36,6 +39,7 @@ handle_error() { EOF echo "Error occurred in:" + echo " Command: $failed_cmd" echo " Line: $line_no" echo " Exit code: $exit_code" exit $exit_code diff --git a/setenv.sh b/setenv.sh index aa780461e..115a5f848 100755 --- a/setenv.sh +++ b/setenv.sh @@ -17,12 +17,15 @@ # limitations under the License. # ################################################################################ -# Quiet evaluate: avoid capturing Maven download lines into the environment (breaks CI with ARG_MAX). -export UNOMI_VERSION="$(mvn -B -q -DforceStdout help:evaluate -Dexpression=project.version -DinteractiveMode=false 2>/dev/null)" +_mvn_err=$(mktemp) +export UNOMI_VERSION="$(mvn -B -q -DforceStdout help:evaluate -Dexpression=project.version -DinteractiveMode=false 2>"$_mvn_err")" if [ -z "$UNOMI_VERSION" ]; then echo "Failed to detect project version from Maven" >&2 + cat "$_mvn_err" >&2 + rm -f "$_mvn_err" exit 1 fi +rm -f "$_mvn_err" echo "Detected project version=$UNOMI_VERSION" export KARAF_VERSION=4.4.8 # Uncomment the following line if you need Apache Unomi to start automatically at the first start From 331f0d2e25985f921fe996c96e2b9ee2103440db Mon Sep 17 00:00:00 2001 From: Serge Huber Date: Thu, 28 May 2026 12:50:09 +0200 Subject: [PATCH 3/3] =?UTF-8?q?UNOMI-937:=20Fix=20BASH=5FCOMMAND=20capture?= =?UTF-8?q?=20in=20ERR=20trap=20=E2=80=94=20truncate=20at=20trap=20site,?= =?UTF-8?q?=20not=20inside=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 00d8dba3d..4b8251326 100755 --- a/build.sh +++ b/build.sh @@ -19,16 +19,15 @@ ################################################################################ set -e # Exit on error -trap 'handle_error $? $LINENO' ERR +# Truncate $BASH_COMMAND in the trap (where it correctly reflects the failing +# command) to avoid ARG_MAX limits after a failed mvn invocation. +trap 'handle_error $? $LINENO "${BASH_COMMAND:0:200}"' ERR # Error handling function handle_error() { local exit_code=$1 local line_no=$2 - # Read BASH_COMMAND inside the function rather than passing it through the - # trap to avoid ARG_MAX limits after a failed mvn invocation; truncate to - # keep the output readable. - local failed_cmd="${BASH_COMMAND:0:200}" + local failed_cmd=$3 cat << "EOF" _____ ____ ____ ___ ____