Bug 65522 - jmeter script file is named with a file name that contains English, Chinese, and spaces, it will cause jmeter to fail to restart.
Summary: jmeter script file is named with a file name that contains English, Chinese, ...
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.4.1
Hardware: PC All
: P2 normal (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
Depends on:
Reported: 2021-08-27 08:41 UTC by chazhongbao
Modified: 2021-08-29 22:44 UTC (History)
2 users (show)

jmeter restart log (46.37 KB, text/plain)
2021-08-29 10:15 UTC, chazhongbao
File name screenshot (8.21 KB, image/png)
2021-08-29 11:36 UTC, chazhongbao

Note You need to log in before you can comment on or make changes to this bug.
Description chazhongbao 2021-08-27 08:41:24 UTC
Steps to reproduce:
                 1. Make a file name "shell 脚本.jmx".
                 2. Use jmeter5.4.1 to open the file.
                 3. Select file  - >  restart option
Desired result:
                   The restart is successful, you can see the gui.
actual results:
                jmeter did not restart

Both jmeter5.3 and jmeter 5.4.1 found this error.
Comment 1 Felix Schumacher 2021-08-29 08:37:09 UTC
Thanks for the report. I can't reproduce the problem with a current build from trunk under Ubuntu (utf-8 as character set).

Have you tried a current build from trunk (https://jmeter.apache.org/nightly.html )?

What is your exact setup? (JVM, OS, character set)
Are there any errors logged in jmeter.log or on the console (if you started JMeter from a console)?
Comment 2 chazhongbao 2021-08-29 10:06:44 UTC
OS information:
Version Windows 10 Home Chinese Version
Version number 21H1
Installation date ‎2021/‎8/‎1
Operating system internal version 19043.1165
Serial number YX029CKY
Experience Windows Feature Experience Pack 120.2212.3530.0

jdk  version:
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

jmeter 5.4.1   download    from  https://jmeter.apache.org/download_jmeter.cgi   page 

After clicking the restart button, jmeter exited the program, but did not restart, and there was no abnormal output in the jmeter log.

Can this information help you?
Comment 3 chazhongbao 2021-08-29 10:15:16 UTC
Created attachment 37999 [details]
jmeter  restart  log

After the jmeter log mode is adjusted from info to debug, please check the output log.
Comment 4 Felix Schumacher 2021-08-29 11:19:18 UTC
What is the path to your Java installation?
Comment 5 chazhongbao 2021-08-29 11:30:16 UTC
JAVA HOME    :              C:\Program FilesVava\jdk1.8.0_131

CLASSPATH    :              ;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

path          :              %JAVA_HOME%\jre\bin
Comment 6 chazhongbao 2021-08-29 11:36:06 UTC
Created attachment 38000 [details]
File name screenshot
Comment 7 Felix Schumacher 2021-08-29 11:38:29 UTC
Can you try if setting JAVA_HOME to "dos short names" or any path, that has no space in it?

Maybe it helps to have a setenv.bat in the bin directory of your jmeter installation with the following content (if JAVA_HOME is set before start of jmeter):

Comment 8 chazhongbao 2021-08-29 11:58:12 UTC
I reinstalled java, there is no space in the installation path, the problem still exists. I think it is not a java environment problem. After removing the spaces in the file name, restart jmeter normally. This should be an exception when reading the jmx file during the restart, but I did not see an error log in jmeter.
Comment 9 Felix Schumacher 2021-08-29 14:31:32 UTC
OK, I can reproduce this when JMeter is started with "-t 'plan with space.jmx'". The problem here is, that the restart logic has no knowledge of the parameters at the time when preparing the restart. So it fails to escape the spaces.

Same thing would happen, if you would use any other starting parameter with spaces in it, like specifying a log file that contains spaces.

As a workaround stop using spaces in file names :) If you want to work on a fix, look into Restart.java in core (https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/gui/action/Restart.java)
Comment 10 chazhongbao 2021-08-29 14:54:22 UTC
Yes, removing the spaces can solve the problem, but if the bug can be fixed, it would be even better.But fixing it may be a bit difficult for me.
Comment 11 Felix Schumacher 2021-08-29 15:26:19 UTC
I applied a fix (hopefully) to trunk. Can you test next nightly or built from trunk (https://jmeter.apache.org/nightly.html )?

commit b9cbab843b13f1d4c61e93ce4b87bff3ef995b66
AuthorDate: Sun Aug 29 17:19:00 2021 +0200

    Restart does not work when parameters contain spaces
    Try to re-combine the parameters to regard spaces in file names
    Java command line has no knowledge of the 'real' parameters and
    we have to do a bit of guessing to re-assemble the parameters with
    spaces and the drop the spaces, that should split the parameters.
    So we guess, that each parameter starts with a dash (-) and
    everything else are values, that should be stitched together.
    Bugzilla Id: 65522
 .../java/org/apache/jmeter/gui/action/Restart.java | 70 +++++++++++++++++-----
 xdocs/changes.xml                                  |  1 +
 2 files changed, 57 insertions(+), 14 deletions(-)
Comment 12 chazhongbao 2021-08-29 22:44:44 UTC
After verification, the problem has been resolved
Comment 13 The ASF infrastructure team 2022-09-24 20:38:22 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5569