-
Notifications
You must be signed in to change notification settings - Fork 75
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
Return a Unique Exit Code for Out of Memory Incidents #1339
base: master
Are you sure you want to change the base?
Changes from 2 commits
6b6b4b8
8fa5fb6
db09734
7fe206b
435951a
d7cfc8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,13 @@ public DetectorToolResult performDetectors( | |
List<DetectorDirectoryReport> reports = new DetectorReporter().generateReport(evaluation); | ||
DetectorToolResult toolResult = publishAllResults(reports, directory, projectDetector, requiredDetectors, requiredAccuracyTypes); | ||
|
||
boolean outOfMemoryIssueFound = detectorIssuePublisher.hasOutOfMemoryIssue(reports); | ||
|
||
if (outOfMemoryIssueFound) { | ||
logger.error("Detected an issue: EXECUTABLE_TERMINATED_LIKELY_OUT_OF_MEMORY."); | ||
exitCodePublisher.publishExitCode(ExitCodeType.FAILURE_OUT_OF_MEMORY, "Executable terminated likely due to out of memory."); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might just be me but I find this error checking a bit distracting in the overall flow of the performDetectors method. Perhaps consider refactoring these lines to a small method you can call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored this error checking into a function called |
||
//Completed. | ||
logger.debug("Finished running detectors."); | ||
detectorEventPublisher.publishDetectorsComplete(toolResult); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An idea for your consideration: we could modify the enum to have a new
double priority
field.Then you could define the new exit code as
FAILURE_OUT_OF_MEMORY(16, "...", 0.5)
, and start sorting exit codes not by their value but by their priority. This would also allow us to insert any priority we want anywhere going forward.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an interesting insight. Surely it can be done. Let's have team's opinion on it whether we should go with this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the ExitCodeType enum as per your suggestion and it worked as expected in my end. As this is planned for 10.4.0 release, the team might have their opinions whether we should go with this approach.