diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e7aed38..dd5e5c99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file. - hbase: replace `sed` calls with `config-utils template` where possible ([#1301]). - superset: Fix the 4.1.2 build when building from source ([#1309]) - superset: Pin `luxon` to version 3.6.1 to fix build ([#1315], [#1316]) +- nifi: Use a patched version of logback to fix corrupted logs ([#1314]) ### Fixed @@ -107,6 +108,7 @@ All notable changes to this project will be documented in this file. [#1308]: https://github.com/stackabletech/docker-images/pull/1308 [#1309]: https://github.com/stackabletech/docker-images/pull/1309 [#1311]: https://github.com/stackabletech/docker-images/pull/1311 +[#1314]: https://github.com/stackabletech/docker-images/pull/1314 [#1315]: https://github.com/stackabletech/docker-images/pull/1315 [#1316]: https://github.com/stackabletech/docker-images/pull/1316 diff --git a/nifi/Dockerfile b/nifi/Dockerfile index 462f66afd..5235a8b4e 100644 --- a/nifi/Dockerfile +++ b/nifi/Dockerfile @@ -5,6 +5,8 @@ ARG GIT_SYNC_VERSION FROM oci.stackable.tech/sdp/git-sync/git-sync:${GIT_SYNC_VERSION} AS git-sync-image +FROM local-image/shared/logback AS patched-logback + FROM local-image/java-devel AS nifi-builder ARG PRODUCT_VERSION @@ -23,8 +25,12 @@ WORKDIR /stackable COPY --chown=${STACKABLE_USER_UID}:0 nifi/stackable/patches/patchable.toml /stackable/src/nifi/stackable/patches/patchable.toml COPY --chown=${STACKABLE_USER_UID}:0 nifi/stackable/patches/${PRODUCT_VERSION} /stackable/src/nifi/stackable/patches/${PRODUCT_VERSION} COPY --chown=${STACKABLE_USER_UID}:0 --from=git-sync-image /git-sync /stackable/git-sync +COPY --chown=${STACKABLE_USER_UID}:0 --from=patched-logback /stackable/.m2/repository /stackable/patched-logback-libs RUN < +Date: Wed, 22 Oct 2025 15:27:29 +0200 +Subject: fix: pin esbuild to fix NiFi 2.6.0 build + +For some reason, npm tries to use a newer version of esbuild than the version in the lock file. I suspect this might be related to how npm handles optional dependencies in lock files. The esbuild version is set to 0.25.10 now to prevent npm from trying to select a newer version, so that the same packages as in the original NiFi build are used. +--- + nifi-frontend/src/main/frontend/package.json | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/nifi-frontend/src/main/frontend/package.json b/nifi-frontend/src/main/frontend/package.json +index ee125e7663..6914c5f00c 100644 +--- a/nifi-frontend/src/main/frontend/package.json ++++ b/nifi-frontend/src/main/frontend/package.json +@@ -114,10 +114,11 @@ + "vite": "^5.4.6", + "underscore": "1.13.6", + "rollup": "4.22.4", +- "esbuild": "^0.25.8", ++ "esbuild": "0.25.10", + "koa": "^2.16.1" + }, + "overrides": { +- "koa": "^2.16.1" ++ "koa": "^2.16.1", ++ "esbuild": "0.25.10" + } + } diff --git a/shared/logback/Dockerfile b/shared/logback/Dockerfile new file mode 100644 index 000000000..8fcd8b03a --- /dev/null +++ b/shared/logback/Dockerfile @@ -0,0 +1,23 @@ +# syntax=docker/dockerfile:1.15.1@sha256:9857836c9ee4268391bb5b09f9f157f3c91bb15821bb77969642813b0d00518d +# check=error=true + +FROM local-image/java-devel AS builder + +ARG PRODUCT_VERSION +ARG RELEASE_VERSION +ARG STACKABLE_USER_UID + +COPY --chown=${STACKABLE_USER_UID}:0 shared/logback/stackable/patches/patchable.toml /stackable/src/shared/logback/stackable/patches/patchable.toml +COPY --chown=${STACKABLE_USER_UID}:0 shared/logback/stackable/patches/${PRODUCT_VERSION} /stackable/src/shared/logback/stackable/patches/${PRODUCT_VERSION} + +USER ${STACKABLE_USER_UID} +WORKDIR /stackable + +RUN < +Date: Wed, 22 Oct 2025 11:13:02 +0200 +Subject: fix: move StringBuilder into function to prevent race conditions + +--- + .../java/ch/qos/logback/classic/log4j/XMLLayout.java | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java +index 4bc04388a..405f4ef26 100644 +--- a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java ++++ b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java +@@ -38,9 +38,7 @@ import ch.qos.logback.core.helpers.Transform; + public class XMLLayout extends LayoutBase { + + private final int DEFAULT_SIZE = 256; +- private final int UPPER_LIMIT = 2048; + +- private StringBuilder buf = new StringBuilder(DEFAULT_SIZE); + private boolean locationInfo = false; + private boolean properties = false; + +@@ -96,13 +94,7 @@ public class XMLLayout extends LayoutBase { + */ + public String doLayout(ILoggingEvent event) { + +- // Reset working buffer. If the buffer is too large, then we need a new +- // one in order to avoid the penalty of creating a large array. +- if (buf.capacity() > UPPER_LIMIT) { +- buf = new StringBuilder(DEFAULT_SIZE); +- } else { +- buf.setLength(0); +- } ++ StringBuilder buf = new StringBuilder(DEFAULT_SIZE); + + // We yield to the \r\n heresy. + diff --git a/shared/logback/stackable/patches/1.3.14/patchable.toml b/shared/logback/stackable/patches/1.3.14/patchable.toml new file mode 100644 index 000000000..a33d0f790 --- /dev/null +++ b/shared/logback/stackable/patches/1.3.14/patchable.toml @@ -0,0 +1,2 @@ +mirror = "https://github.com/stackabletech/logback.git" +base = "39fc5461e7a8e15ce9ecd9f148f67f701aed88ad" diff --git a/shared/logback/stackable/patches/1.5.18/0001-fix-move-StringBuilder-into-function-to-prevent-race.patch b/shared/logback/stackable/patches/1.5.18/0001-fix-move-StringBuilder-into-function-to-prevent-race.patch new file mode 100644 index 000000000..18ac0cc90 --- /dev/null +++ b/shared/logback/stackable/patches/1.5.18/0001-fix-move-StringBuilder-into-function-to-prevent-race.patch @@ -0,0 +1,38 @@ +From 174aa552f3f1fc03dcce3b37f24993b77b90ab71 Mon Sep 17 00:00:00 2001 +From: dervoeti +Date: Fri, 17 Oct 2025 12:07:51 +0200 +Subject: fix: move StringBuilder into function to prevent race conditions + +--- + .../java/ch/qos/logback/classic/log4j/XMLLayout.java | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java +index 4bc04388a..405f4ef26 100644 +--- a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java ++++ b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java +@@ -38,9 +38,7 @@ import ch.qos.logback.core.helpers.Transform; + public class XMLLayout extends LayoutBase { + + private final int DEFAULT_SIZE = 256; +- private final int UPPER_LIMIT = 2048; + +- private StringBuilder buf = new StringBuilder(DEFAULT_SIZE); + private boolean locationInfo = false; + private boolean properties = false; + +@@ -96,13 +94,7 @@ public class XMLLayout extends LayoutBase { + */ + public String doLayout(ILoggingEvent event) { + +- // Reset working buffer. If the buffer is too large, then we need a new +- // one in order to avoid the penalty of creating a large array. +- if (buf.capacity() > UPPER_LIMIT) { +- buf = new StringBuilder(DEFAULT_SIZE); +- } else { +- buf.setLength(0); +- } ++ StringBuilder buf = new StringBuilder(DEFAULT_SIZE); + + // We yield to the \r\n heresy. + diff --git a/shared/logback/stackable/patches/1.5.18/patchable.toml b/shared/logback/stackable/patches/1.5.18/patchable.toml new file mode 100644 index 000000000..01153d924 --- /dev/null +++ b/shared/logback/stackable/patches/1.5.18/patchable.toml @@ -0,0 +1,2 @@ +mirror = "https://github.com/stackabletech/logback.git" +base = "b2a02f065379a9b1ba5ff837fc08913b744774bc" diff --git a/shared/logback/stackable/patches/patchable.toml b/shared/logback/stackable/patches/patchable.toml new file mode 100644 index 000000000..fb98269ec --- /dev/null +++ b/shared/logback/stackable/patches/patchable.toml @@ -0,0 +1,2 @@ +upstream = "https://github.com/qos-ch/logback.git" +default-mirror = "https://github.com/stackabletech/logback.git"