You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "mbien (via GitHub)" <gi...@apache.org> on 2023/01/29 16:53:09 UTC

[GitHub] [netbeans] mbien commented on a diff in pull request #5384: [NETBEANS-4054] Ensuring progress when javac crashes while batch evaluating hints.

mbien commented on code in PR #5384:
URL: https://github.com/apache/netbeans/pull/5384#discussion_r1090006555


##########
java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearch.java:
##########
@@ -246,8 +247,15 @@ public void run(CompilationController parameter) throws Exception {
                                 boolean cont = true;
 
                                 try {
-                                    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 ;
+                                    }

Review Comment:
   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.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists