[ 
https://issues.apache.org/jira/browse/KNOX-3246?focusedWorklogId=1002443&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1002443
 ]

ASF GitHub Bot logged work on KNOX-3246:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jan/26 11:05
            Start Date: 29/Jan/26 11:05
    Worklog Time Spent: 10m 
      Work Description: github-actions[bot] commented on PR #1141:
URL: https://github.com/apache/knox/pull/1141#issuecomment-3816961476

   ## Test Results
   7 tests   7 ✅  1s ⏱️
   1 suites  0 💤
   1 files    0 ❌
   
   Results for commit 95c97fc6.
   
   
[test-results]:data:application/gzip;base64,H4sIAAQ/e2kC/1WMyw6DIBQFf8Ww7gJFofRnGrhAclOVhseq6b8XrQ/cnZmTzIc4HG0kj6a9NSRmTAeYHFRCP29YjrRcYt/PmAGu4oXvIughnMLxImwIPmwm5HnvLbPO/fmsrVzFVq5b4KcJUwEiB5DCAZdMacm1aSmVndMUBBPMCN7f+45xy8n3B+9XaUj7AAAA
   




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1002443)
    Time Spent: 20m  (was: 10m)

> Make Java discovery deterministic on hosts with multiple JDKs
> -------------------------------------------------------------
>
>                 Key: KNOX-3246
>                 URL: https://issues.apache.org/jira/browse/KNOX-3246
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: Startup Scripts
>    Affects Versions: 2.1.0, 3.0.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Critical
>             Fix For: 3.0.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h3. *Problem*
> Knox Java discovery is non-deterministic on hosts with multiple JDK 
> installations.
> In environments where both Java 11 and Java 17 are installed, neither version 
> is matched by the current {{{}JAVA_VERSION_PATTERNS{}}}. As a result, Java 
> detection falls back to the generic {{/bin/java$}} pattern and selects the 
> first match returned by {{{}find{}}}.
> Because the order of results from {{find}} is not guaranteed, different hosts 
> in the same cluster may select different Java versions, leading to 
> inconsistent and unpredictable behavior.
> ----
> h3. *Root Cause*
>  * {{JAVA_VERSION_PATTERNS}} does not include patterns for Java 11 or Java 17 
> installations.
>  * {{{}/usr/java/default/bin/java{}}}, commonly used to define the 
> system-preferred Java, is not recognized.
>  * {{find}} is executed without {{{}-L{}}}, so symlinks are not followed.
>  * The fallback selection uses {{head -n 1}} without stabilizing the result 
> order.
> ----
> h3. *Example*
> On different hosts in the same cluster:
> {code:java}
> /usr/lib/jvm/jdk1.17.0.11.0-openjdk/bin/java
> /usr/java/jdk1.11.70.15-z.0_lu/bin/java{code}
>  
> or
> {code:java}
> /usr/java/jdk1.11.70.15-z.0_lu/bin/java
> /usr/lib/jvm/jdk1.17.0.11.0-openjdk/bin/java{code}
>  
> Depending on the host, Knox may start with Java 11 or Java 17.
> ----
> h3. *Proposed Fix*
>  * Extend {{JAVA_VERSION_PATTERNS}} to explicitly recognize Java 11 and Java 
> 17 layouts.
>  * Add support for {{/usr/java/default/bin/java}} to honor the system default 
> Java.
>  * Use {{find -L}} to follow symlinks.
>  * Sort Java candidates before selecting the first match to ensure 
> deterministic behavior.
> ----
> h3. *Impact*
> Ensures consistent Java version selection across all nodes in a cluster, 
> prevents unpredictable startup behavior, and aligns Knox Java discovery with 
> common enterprise JDK layouts.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to