ChaiBapchya opened a new pull request #17597: move stacktrance print to console 
rather than system.err
URL: https://github.com/apache/incubator-mxnet/pull/17597
 
 
   ## Description ##
   Right now with #17465 if the build fails, we print the stacktrace using 
`error.printStackTrace()` function
   
   a. It is an insecure function that needs to be approved by administrators in 
Jenkins -> Manage Jenkins -> In-process Script approval
   Without the approval it gives SandBox error
   ```
   `org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: 
Scripts not permitted to use method java.lang.Throwable getStackTrace`
   ```
   
   b. However, the `error.printStackTrace()` function sends the report to 
System.err
   It doesn't get printed on the console.
   To print on console, it has to be passed as a parameter.
   Verified it works by adding a failure case in the try (so as to enter the 
"catch")
   ```
   try {
       update_github_commit_status('PENDING', 'Job has been enqueued')
       System.out.println(12 / 0)
   }
   ```
   It enters catch and then prints the stack trace for divide by zero exception 
as expected.
   
   Refer : 
   
http://jenkins.mxnet-ci-dev.amazon-ml.com/job/mxnet-validation/job/apache-unix-cpu/job/remove_print_stacktrace/lastBuild/console
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - [ ] Code is well-documented: 
   - [ ] To the best of my knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ## Comments ##
   Read more about Jenkins Script Security : 
https://plugins.jenkins.io/script-security/
   
   How to handle printStackTrace - 
https://stackoverflow.com/questions/12095378/difference-between-e-printstacktrace-and-system-out-printlne

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to