[ 
https://issues.apache.org/jira/browse/KAFKA-20024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

AbyssFishRover updated KAFKA-20024:
-----------------------------------
    Description: 
Hello,During my usage of Kafka, I identified an issue. In the 
{{kafka-server-start.bat}} script, there is a logic that sets different startup 
parameters based on the bitness (32-bit/64-bit) of the operating system. The 
relevant code is as follows:
{code:java}
IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
    rem detect OS architecture
    wmic os get osarchitecture | find /i "32-bit" >nul 2>&1
    IF NOT ERRORLEVEL 1 (
        rem 32-bit OS
        set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
    ) ELSE (
        rem 64-bit OS
        set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
    )
) {code}
It first queries wmic os get osarchitecture, then determines whether the 
operating system is 32-bit or 64-bit by checking if the result contains the 
string "32-bit". However, my actual tests show that this method is not 
reliable—the returned results vary across Windows systems with different 
languages and regional settings, as shown below:

 

{*}English Windows{*}:

!image-2025-12-30-16-27-52-195.png!

{*}Chinese Windows{*}:
!image-2025-12-30-16-28-25-539.png!
**

{*}French Windows{*}:

!image-2025-12-30-16-28-42-798.png!

{*}German Windows{*}:

!image-2025-12-30-16-29-03-343.png!

{*}Japanese Windows{*}:

*!image-2025-12-30-16-29-19-289.png!*

{*}Older Windows XP systems{*}:

!image-2025-12-30-16-29-36-542.png!

Kafka has users across the globe, and the current approach {*}lacks 
universality{*}.

  was:
Hello,During my usage of Kafka, I identified an issue. In the 
{{kafka-server-start.bat}} script, there is a logic that sets different startup 
parameters based on the bitness (32-bit/64-bit) of the operating system. The 
relevant code is as follows:
{code:java}
IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
    rem detect OS architecture
    wmic os get osarchitecture | find /i "32-bit" >nul 2>&1
    IF NOT ERRORLEVEL 1 (
        rem 32-bit OS
        set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
    ) ELSE (
        rem 64-bit OS
        set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
    )
) {code}
It first queries wmic os get osarchitecture, then determines whether the 
operating system is 32-bit or 64-bit by checking if the result contains the 
string "32-bit". However, my actual tests show that this method is not 
reliable—the returned results vary across Windows systems with different 
languages and regional settings, as shown below:

 

{*}English Windows{*}:

!image-2025-12-30-16-27-52-195.png!

{*}Chinese Windows{*}:
!image-2025-12-30-16-28-25-539.png!
{*}French Windows{*}:

!image-2025-12-30-16-28-42-798.png!

{*}German Windows{*}:

!image-2025-12-30-16-29-03-343.png!

{*}Japanese Windows{*}:

*!image-2025-12-30-16-29-19-289.png!*

{*}Older Windows XP systems{*}:

!image-2025-12-30-16-29-36-542.png!

Kafka has users across the globe, and the current approach {*}lacks 
universality{*}.


> wmic os get osarchitecture is unreliable for detecting OS bitness in bat 
> scripts
> --------------------------------------------------------------------------------
>
>                 Key: KAFKA-20024
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20024
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: AbyssFishRover
>            Assignee: AbyssFishRover
>            Priority: Major
>         Attachments: image-2025-12-30-16-27-52-195.png, 
> image-2025-12-30-16-28-25-539.png, image-2025-12-30-16-28-42-798.png, 
> image-2025-12-30-16-29-03-343.png, image-2025-12-30-16-29-19-289.png, 
> image-2025-12-30-16-29-36-542.png
>
>
> Hello,During my usage of Kafka, I identified an issue. In the 
> {{kafka-server-start.bat}} script, there is a logic that sets different 
> startup parameters based on the bitness (32-bit/64-bit) of the operating 
> system. The relevant code is as follows:
> {code:java}
> IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
>     rem detect OS architecture
>     wmic os get osarchitecture | find /i "32-bit" >nul 2>&1
>     IF NOT ERRORLEVEL 1 (
>         rem 32-bit OS
>         set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
>     ) ELSE (
>         rem 64-bit OS
>         set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
>     )
> ) {code}
> It first queries wmic os get osarchitecture, then determines whether the 
> operating system is 32-bit or 64-bit by checking if the result contains the 
> string "32-bit". However, my actual tests show that this method is not 
> reliable—the returned results vary across Windows systems with different 
> languages and regional settings, as shown below:
>  
> {*}English Windows{*}:
> !image-2025-12-30-16-27-52-195.png!
> {*}Chinese Windows{*}:
> !image-2025-12-30-16-28-25-539.png!
> **
> {*}French Windows{*}:
> !image-2025-12-30-16-28-42-798.png!
> {*}German Windows{*}:
> !image-2025-12-30-16-29-03-343.png!
> {*}Japanese Windows{*}:
> *!image-2025-12-30-16-29-19-289.png!*
> {*}Older Windows XP systems{*}:
> !image-2025-12-30-16-29-36-542.png!
> Kafka has users across the globe, and the current approach {*}lacks 
> universality{*}.



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

Reply via email to