apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.

Home Page:https://rocketmq.apache.org/

Repository from Github https://github.comapache/rocketmqRepository from Github https://github.comapache/rocketmq

[Bug] runbroker.cmd miss %JAVA_OPT% on windows

frankcrc opened this issue · comments

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

Windows 11

RocketMQ version

rocketmq 5.2.0 release

JDK Version

Oracle JDK 1.8_u202

Describe the Bug

Run a namesrv, and check cmd line in Task Manager or Process Explorer, then you will see JAVA_OPT, like -Xmx, is missing.

This is JAVA_OPT config in runserver.cmd.
runserver.cmd_JAVA_OPT

This is CMD line of the namesrv process.
cmd line

Steps to Reproduce

  1. Prepare a namesrv config file, let say namesrv.conf. I think it does not matter, but just to reproduce my env.
enableControllerInNamesrv = true
controllerDLegerGroup = group1
controllerDLegerPeers = n0-127.0.0.1:9877
controllerDLegerSelfId = n0
  1. Prepare a powershell script file, let say start-namesrv-w-c.ps1.
$env:JAVA_OPT='-Duser.home=D:\data\mq_data\rocketmq-all-5.2.0-bin-release\data\namesrv'
$env:ROCKETMQ_HOME='D:\data\mq_data\rocketmq-all-5.2.0-bin-release'
D:\data\mq_data\rocketmq-all-5.2.0-bin-release\bin\mqnamesrv.cmd -c D:\data\mq_data\rocketmq-all-5.2.0-bin-release\data\namesrv.conf
  1. Open a Powershell and execute the script file, .\start-namesrv-w-c.ps1.
  2. Check process cmd line.

What Did You Expect to See?

the java process cmd line should contain -Xmx300m and all other jvm options.

What Did You See Instead?

only JAVA_OPT what I set in start-namesrv-w-c.ps1 is kept.

Additional Context

I think it should be the problem of batch variable substitution. When I comment out the IF statement, JAVA_OPT comes back.

runserver.cmd diff

This is CMD line of the namesrv process.
Image

If possible, I would be happy to create a PR.

Related Issue, #8579,
Related PR, #7507