[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.
This is CMD line of the namesrv process.
Steps to Reproduce
- 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
- 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
- Open a Powershell and execute the script file,
.\start-namesrv-w-c.ps1
. - 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.
This is CMD line of the namesrv process.
If possible, I would be happy to create a PR.