-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Issue #14396: checker-framework.yml should fail execution if report generation fails #14409
Conversation
7e75f68
to
f46ab42
Compare
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.
Items
.ci/checker-framework.groovy
Outdated
BufferedReader reader = null | ||
try { | ||
reader = new BufferedReader(new InputStreamReader(process.inputStream)) | ||
String lineFromReader = reader.readLine() | ||
while (lineFromReader != null) { | ||
println(lineFromReader) | ||
checkerFrameworkLines.add(lineFromReader) | ||
if (lineFromReader.contains("OutOfMemoryError")) { |
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.
We need any error, can we make code general ?
Can we simply rely on mvn
exit code?
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.
Okay.
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.
We need any error, can we make code general ? Can we simply rely on
mvn
exit code?
I am trying to throw an exception the moment it encounters a non-zero exit code, assuming a OOM detected. And, this probably might make the CI/CD to fail. Please let me know your thoughts on it.
f46ab42
to
0a9bf49
Compare
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.
I like this a way more
how do we test such scenarios in our local? |
You can update groovy to start mvn with low memory like |
Sure, thanks. |
4ebf7dc
to
af362fb
Compare
@romani, @rnveach I tried with reducing the jvm heap size to check if the code i added was running fine. But, even at 128mb, i am not being able to simulate an OOM. The other way i tried was runing a infinite loop, the CI did hint towards a OOM, but, as obvious the lines of code I added to terminal the script wasn't executed. Any alternative or correction needed? |
233b364
to
e7fc6c0
Compare
Even if I am failing to replicate OOM, but, atleast I am being able to register an exit status which I had introduced throwin a RunTimeException from the below logs. So, possibly this might also be the case when maven executions runs out of memory.
|
We bumped memory usage for maven to bypass this problem in CI, if we revert such commit we should be able reproduce problem in CI, but instead of weird failure of diff on suppression we should have failed step of report generation. Commit revert might be too much, but revert of lines as 1a041e3#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8L2938 should bring us back to CI problem to run Checker |
df4617b
to
fb75b89
Compare
adba322
to
c77b498
Compare
@nrmancuso, I have added the reports of before and after changes. Without any changes to groovy file, we continue to get OOM but with some strange suppressions as reported previously https://github.com/checkstyle/checkstyle/actions/runs/7947755703/job/21696975080?pr=14409 After groovy changes, we can handle the OOM properly https://github.com/checkstyle/checkstyle/actions/runs/7947830206/job/21697133364?pr=14409 |
Done. |
|
<failOnError>false</failOnError> | ||
<meminitial>1024m</meminitial> | ||
<maxmem>8192m</maxmem> | ||
<failOnError>true</failOnError> |
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.
How will the maven execution fail without this?
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.
If I understood it right, the final commit must have the changes of groovy including failOnError
be true for all checkers.
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.
If I understood it right, the final commit must have the changes of groovy including
failOnError
be true for all checkers.
Yes, that’s right. Right now, we only have one updated, and it is in the “hack” to cause OOM commit.
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.
Thank you for the review. I have made the changes. Please let me know if they are right.
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.
Ok, let's drop other commits and prepare for merge.
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.
@relentless-pursuit codenarc is failing in semaphore:
Violation: Rule=ThrowRuntimeException P=2 Line=132 Msg=[The type RuntimeException should not be thrown] Src=[throw new RuntimeException("Maven process exited with error code: " + exitCode)]
Is there a specific reason to throw an exception here? Can we just System.exit(1)
?
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.
System.exit(1)
After thinking on this, this is a hack that we should probably avoid. I also have doubts about whether we would execute the finally
block below this to close the reader. @relentless-pursuit let's keep it the way you had it and find a more specific exception class as recommended by codenarc: https://codenarc.org/codenarc-rules-exceptions.html#:~:text=Checks%20for%20throwing%20an%20instance%20of%20java.lang.RuntimeException.%20Throw%20an%20instance%20of%20a%20more%20specific%20exception%20subclass%20instead.
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.
Sure, I was cross-checking and it didn't give me OOM error when i used System.exit(1
).
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.
Let's do IllegalStateException
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.
Let's do
IllegalStateException
Done. I also checked with the hack, and it seems to be working fine. https://github.com/checkstyle/checkstyle/actions/runs/7974597699/job/21770876534?pr=14409
3417172
to
34b1b6f
Compare
….groovy to fail execution if report generation fails
34b1b6f
to
17a184b
Compare
@relentless-pursuit thanks for working on this, I know these sorts of issues can get pretty involved! |
Always happy to help Checkstyle. And, thanks to you and other maintainers for always being patient with the contributors like me. |
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.
Ok to merge, elegant fix.
Resolve #14396
This PR enhances the GitHub Actions workflow for the Checker Framework by ensuring execution fails upon detecting errors during report generation.