-
Notifications
You must be signed in to change notification settings - Fork 823
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
[NETBEANS-4054] Ensuring progress when javac crashes while batch evaluating hints. #5384
Conversation
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.
looks good to me, this is actually somewhat similar to the hotfix I proposed here it just limits it to single-file use only.
if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) | ||
if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) { | ||
if (currentInputList.size() == 1) { | ||
//the javac crashed while processing the (single) file, we must ensure progress, otherwise infinite loop in processing would happen: | ||
problems.add(new MessageImpl(MessageKind.WARNING, "An error occurred while processing file: " + FileUtil.getFileDisplayName(parameter.getFileObject()) + ", please see the IDE log for more information.")); | ||
currentPointer.incrementAndGet(); | ||
} | ||
|
||
return ; | ||
} |
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.
this means that this can't happen when BatchSearch
is used on multiple files because it wouldn't reuse javac instances there?
So the only reason it tries again with the same file when Phase.RESOLVED
can't be reached is because of a possible OOM situation?
If that is the case we should add some kind of per-file retry counter. while(true)
loops are always a bit of a danger zone.
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 hints are run on save,
BatchSearch
is called on a single file. Normally, if javac would crash duringtoPhase
, an exception would be thrown. But, it may happen the existing parser is reused, andtoPhase
does not throw the exception, and this may be mistaken for an out-of-memory situation, to which the response is to restart the processing. This may then lead to an infinite loop.The proposed change here is to force progress in this situation. javac crash(es) need to be handled separately, of course.
^Add meaningful description above
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log
) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.