Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal execution result if the script has a null character(0x0) #32

Closed
newpcraft opened this issue Mar 1, 2014 · 6 comments
Closed
Labels

Comments

@newpcraft
Copy link
Contributor

While running a test, the agent shows the following exception if it has a null character even the script has no error.
When it is saved by the editor of ngrinder controller, there are no issue because the null character has already trimmed by the editor. However, while saving a script content by rest api, null characters are not handled.
So, it maybe need to trim a null character in the script content due to improve reliability.

ERROR worker-bootstrap: Error running worker process
net.grinder.engine.common.EngineException: Error while initialize test runner
    at net.grinder.scriptengine.groovy.GroovyScriptEngine.<init>(GroovyScriptEngine.java:71) ~[ngrinder-groovy-3.3.1-SNAPSHOT.jar:na]
    at net.grinder.scriptengine.groovy.GroovyScriptEngineService.createScriptEngine(GroovyScriptEngineService.java:109) ~[ngrinder-groovy-3.3.1-SNAPSHOT.jar:na]
    at net.grinder.engine.process.ScriptEngineContainer.getScriptEngine(ScriptEngineContainer.java:105) ~[grinder-core-3.9.1.jar:na]
    at net.grinder.engine.process.GrinderProcess.run(GrinderProcess.java:329) ~[ngrinder-runtime-3.3.1-SNAPSHOT.jar:na]
    at net.grinder.engine.process.WorkerProcessEntryPoint.run(WorkerProcessEntryPoint.java:87) [grinder-core-3.9.1.jar:na]
    at net.grinder.engine.process.WorkerProcessEntryPoint.main(WorkerProcessEntryPoint.java:60) [grinder-core-3.9.1.jar:na]
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/NAVER/.ngrinder_agent/file-store/admin/current/TestRunner.groovy: 26: unexpected char: 0x0 @ line 26, column 1.

   ^

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:149) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:119) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:131) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:359) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:137) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:108) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:162) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:912) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:574) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550) ~[groovy-all-2.2.1.jar:2.2.1]
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527) ~[groovy-all-2.2.1.jar:2.2.1]
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) ~[groovy-all-2.2.1.jar:2.2.1]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) ~[groovy-all-2.2.1.jar:2.2.1]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244) ~[groovy-all-2.2.1.jar:2.2.1]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:185) ~[groovy-all-2.2.1.jar:2.2.1]
    at net.grinder.scriptengine.groovy.GroovyScriptEngine.<init>(GroovyScriptEngine.java:62) ~[ngrinder-groovy-3.3.1-SNAPSHOT.jar:na]
    ... 5 common frames omitted
@newpcraft newpcraft self-assigned this Mar 1, 2014
@newpcraft newpcraft added the bug label Mar 1, 2014
newpcraft added a commit that referenced this issue Mar 1, 2014
Fixed this bug to be trimmed null characters while saving a script.
But, I didn't consider to handle this when compile a script, so this
fixed didn't be a solution if there has already included a null
character in a script.
@newpcraft
Copy link
Contributor Author

Fixed this bug to be trimmed null characters while saving a script. But, I didn't consider to handle this when compile a script, so this fixed didn't be a solution if there has already included a null character in a script.

@junoyoon
Copy link
Contributor

junoyoon commented Mar 3, 2014

Good change!

@newpcraft
Copy link
Contributor Author

This fix is only for using rest api. So, when user use svn to save a script on outside of ngrinder, ngrinder can't ensure this abnormal issue. I think, the easy way is to fixed in get entry methods, but I don't like this way.
It maybe the best way that is to be removed null characters when ngrinder is trying to distribute their script...

@junoyoon
Copy link
Contributor

junoyoon commented Mar 4, 2014

@newpcraft However, Is it best design to block null characters in the controller level? Just blocking.
Currently your fix includes the replacement logic. However I'm not sure that it's valid choice. When does the user try to save the content containing null character, I believe it's the user fault. So Isn't it better to raise exception instead of swallowing it? What do you think?

@newpcraft
Copy link
Contributor Author

@junoyoon I think you are right. If there is only one behavior to be fixed, the replacement logic might be suitable because of convenience for user. But, currently, after I fixed, I got to know that my fix was not a perfect solution because I found another place where I need to fix.
I will rollback my fix after I try to check whether there could be caused a problem when the compiler throws an exception even test using rest api.

@junoyoon junoyoon mentioned this issue Mar 5, 2014
newpcraft added a commit that referenced this issue Mar 25, 2014
- Rollback this code because wrong script might user fault.
@newpcraft
Copy link
Contributor Author

Rollbacked because wrong script might user fault.
If this issue might be affected other users on ngrinder service, we try to investigate it again.

@newpcraft newpcraft removed their assignment Jun 25, 2014
lopiter pushed a commit that referenced this issue Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants