[
https://issues.apache.org/jira/browse/NIFI-15255?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fatih Mehmet ARSLAN updated NIFI-15255:
---------------------------------------
Description:
*Summary*
The NiFi Docker image still includes an old {{prop_add_or_replace}} function in
{{{}start.sh/common.sh{}}}, which uses {{awk}} without specifying a file. This
causes duplicate properties in {{nifi.properties}} and sometimes a startup hang.
This does *not* occur in the upstream NiFi codebase (which no longer uses these
scripts), but it still affects the official Docker image.
*Problem*
Inside the Docker image:
{{property_found=$(awk -v property="${1}" 'index($0, property) == 1')}} *
{{awk}} reads from stdin instead of a real file
* Existing properties are never detected → always appended
* Results in duplicate keys like:
{{nifi.env.s3-bucket=...nifi.env.s3-bucket=...}}
NiFi 2.6.0 fails to start with:
{{Duplicate property keys with different values were detected}}
If the property does not exist, {{awk}} also waits for input → script can hang.
*Steps to Reproduce*
# Run NiFi via {{{}apache/nifi:2.6.0{}}}.
# Add any dynamic property in start.sh, e.g.:
{{prop_add_or_replace 'nifi.env.test' 'value'}}
# Restart container multiple times.
# Check {{{}nifi.properties{}}}.
*Expected*
* Detect the property if it exists.
* Replace instead of append.
* No duplicate keys.
*Actual*
* Key is always appended.
* Startup eventually fails.
*Suggested Fix*
Use a file-aware check:
{{if grep -q -E "^${1}=" "${target_file}"; then prop_replace "$1" "$2"
"${target_file}"elseecho "$1=$2" >> "${target_file}"fi}}
(or update Docker image to match new Java-based bootstrap logic).
----
If helpful, I can provide a PR or test a patched Docker image.
was:
*Summary*
The NiFi Docker image still includes an old {{prop_add_or_replace}} function in
{{{}start.sh/common.sh{}}}, which uses {{awk}} without specifying a file. This
causes duplicate properties in {{nifi.properties}} and sometimes a startup hang.
This does *not* occur in the upstream NiFi codebase (which no longer uses these
scripts), but it still affects the official Docker image.
----
*Problem*
Inside the Docker image:
{{property_found=$(awk -v property="${1}" 'index($0, property) == 1')}} *
{{awk}} reads from stdin instead of a real file
* Existing properties are never detected → always appended
* Results in duplicate keys like:
{{nifi.env.s3-bucket=...nifi.env.s3-bucket=...}}
NiFi 2.6.0 fails to start with:
{{Duplicate property keys with different values were detected}}
If the property does not exist, {{awk}} also waits for input → script can hang.
----
*Steps to Reproduce*
# Run NiFi via {{{}apache/nifi:2.6.0{}}}.
# Add any dynamic property in start.sh, e.g.:
{{prop_add_or_replace 'nifi.env.test' 'value'}}
# Restart container multiple times.
# Check {{{}nifi.properties{}}}.
----
*Expected*
* Detect the property if it exists.
* Replace instead of append.
* No duplicate keys.
*Actual*
* Key is always appended.
* Startup eventually fails.
----
*Suggested Fix*
Use a file-aware check:
{{if grep -q -E "^${1}=" "${target_file}"; then prop_replace "$1" "$2"
"${target_file}"elseecho "$1=$2" >> "${target_file}"fi}}
(or update Docker image to match new Java-based bootstrap logic).
----
If helpful, I can provide a PR or test a patched Docker image.
> Docker image still uses legacy start.sh/common.sh with broken
> prop_add_or_replace (related to #NIFI-14575)
> ----------------------------------------------------------------------------------------------------------
>
> Key: NIFI-15255
> URL: https://issues.apache.org/jira/browse/NIFI-15255
> Project: Apache NiFi
> Issue Type: Bug
> Components: Docker
> Affects Versions: 2.6.0
> Reporter: Fatih Mehmet ARSLAN
> Priority: Major
>
> *Summary*
> The NiFi Docker image still includes an old {{prop_add_or_replace}} function
> in {{{}start.sh/common.sh{}}}, which uses {{awk}} without specifying a file.
> This causes duplicate properties in {{nifi.properties}} and sometimes a
> startup hang.
> This does *not* occur in the upstream NiFi codebase (which no longer uses
> these scripts), but it still affects the official Docker image.
> *Problem*
> Inside the Docker image:
>
> {{property_found=$(awk -v property="${1}" 'index($0, property) == 1')}} *
> {{awk}} reads from stdin instead of a real file
> * Existing properties are never detected → always appended
> * Results in duplicate keys like:
>
> {{nifi.env.s3-bucket=...nifi.env.s3-bucket=...}}
> NiFi 2.6.0 fails to start with:
>
> {{Duplicate property keys with different values were detected}}
> If the property does not exist, {{awk}} also waits for input → script can
> hang.
> *Steps to Reproduce*
> # Run NiFi via {{{}apache/nifi:2.6.0{}}}.
> # Add any dynamic property in start.sh, e.g.:
>
> {{prop_add_or_replace 'nifi.env.test' 'value'}}
> # Restart container multiple times.
> # Check {{{}nifi.properties{}}}.
> *Expected*
> * Detect the property if it exists.
> * Replace instead of append.
> * No duplicate keys.
> *Actual*
> * Key is always appended.
> * Startup eventually fails.
> *Suggested Fix*
> Use a file-aware check:
>
> {{if grep -q -E "^${1}=" "${target_file}"; then prop_replace "$1" "$2"
> "${target_file}"elseecho "$1=$2" >> "${target_file}"fi}}
> (or update Docker image to match new Java-based bootstrap logic).
> ----
> If helpful, I can provide a PR or test a patched Docker image.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)