Skip to content
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

Consider more brief error display when there is an exception #763

Closed
Tracked by #785 ...
t0yv0 opened this issue Jul 22, 2022 · 1 comment · Fixed by #776
Closed
Tracked by #785 ...

Consider more brief error display when there is an exception #763

t0yv0 opened this issue Jul 22, 2022 · 1 comment · Fixed by #776
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@t0yv0
Copy link
Member

t0yv0 commented Jul 22, 2022

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

When a user program throws an exception, currently pulumi displays a lot of extraneous output. It would be better to keep it shorter.

Reproduce

  • pulumi new java
  • Edit App.java to introduce an exception
package myproject;

import com.pulumi.Pulumi;
import com.pulumi.core.Output;

public class App {
    public static void main(String[] args) {
        Pulumi.run(ctx -> {
                throw new RuntimeException("!");
        });
    }
}
  • pulumi preview

Current behavior

Previewing update (dev)

View Live: https://app.pulumi.com/t0yv0/java-err/dev/previews/bd4c9717-23ee-460a-a7b9-e01578017d8c

     Type                 Name          Plan     Info
     pulumi:pulumi:Stack  java-err-dev           2 errors; 26 messages
 
Diagnostics:
  pulumi:pulumi:Stack (java-err-dev):
    error: Running program [PID: 72405](/nix/store/9ipv6vyd9ky7lv0qprdh7m58x8l7nsk9-zulu17.30.15-ca-jdk-17.0.1/bin/java -classpath /nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/bin/m2.conf -Dmaven.home=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven -Dlibrary.jansi.path=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/Users/anton/tmp/48h/java-err org.codehaus.plexus.classworlds.launcher.Launcher --no-transfer-progress compile exec:java) failed with an unhandled exception:
    java.lang.RuntimeException: !
        at myproject.App.lambda$main$0(App.java:9)
        at com.pulumi.internal.PulumiInternal.lambda$runAsyncResult$2(PulumiInternal.java:77)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
    error: an unhandled error occurred: '/Users/anton/.nix-profile/bin/mvn /Users/anton/.nix-profile/bin/mvn --no-transfer-progress compile exec:java' exited with non-zero exit code: 32
 
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------< com.pulumi:java-err >-------------------------
    [INFO] Building java-err 1.0-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ java-err ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /Users/anton/tmp/48h/java-err/src/main/resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ java-err ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ java-err ---
 
    Jul 22, 2022 3:06:15 PM com.pulumi.deployment.internal.DeploymentImpl$DefaultEngineLogger errorAsync
    SEVERE: Running program [PID: 72405](/nix/store/9ipv6vyd9ky7lv0qprdh7m58x8l7nsk9-zulu17.30.15-ca-jdk-17.0.1/bin/java -classpath /nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/bin/m2.conf -Dmaven.home=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven -Dlibrary.jansi.path=/nix/store/wj3wy60sahbhrwmzn3iilqmzf972bhkp-apache-maven-3.8.4/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/Users/anton/tmp/48h/java-err org.codehaus.plexus.classworlds.launcher.Launcher --no-transfer-progress compile exec:java) failed with an unhandled exception:
    java.lang.RuntimeException: !
        at myproject.App.lambda$main$0(App.java:9)
        at com.pulumi.internal.PulumiInternal.lambda$runAsyncResult$2(PulumiInternal.java:77)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Desired behavior

Previewing update (dev)

View Live: https://app.pulumi.com/t0yv0/java-err/dev/previews/bd4c9717-23ee-460a-a7b9-e01578017d8c

     Type                 Name          Plan     Info
     pulumi:pulumi:Stack  java-err-dev           1 error
 
Diagnostics:
  pulumi:pulumi:Stack (java-err-dev):
    error: Uncaught exception
    java.lang.RuntimeException: !
        at myproject.App.lambda$main$0(App.java:9)
        at com.pulumi.internal.PulumiInternal.lambda$runAsyncResult$2(PulumiInternal.java:77)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Rationale:

Exceptions in user code should be expected, and common, and we should optimize how to display them.

  • it may be useful to see the stack trace that points to App.java:9
  • it is NOT useful to see the exception twice
  • 2 errors; 26 messages --> 1 error is better
  • [INFO] Scanning for projects... build logs are not helpful at all, since the project builds fine; I suspect an implementation detail is leaking here that Java was running plugin detection but hit the error? Need to investigate why it is there, and remove
  • Jul 22, 2022 3:06:15 PM com.pulumi.deployment.internal.DeploymentImpl$DefaultEngineLogger errorAsync this should be remove
  • Running program [PID: 72405](/nix/store/9ipv6vyd9ky7lv0qprdh7m58x8l7nsk9-zulu17.30.15-ca-jdk-17.0.1/bin/java .. these details might be helpful for a user that needs to dig in, but they're not at the right logging level, and it's utterly confusing why java is invoked twice in different ways; also there are way too many parameters; this may need to switch to DEBUG logging level

Affected area/feature

@t0yv0 t0yv0 added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Jul 22, 2022
@t0yv0 t0yv0 removed the needs-triage Needs attention from the triage team label Jul 22, 2022
@t0yv0 t0yv0 mentioned this issue Jul 22, 2022
40 tasks
@mikhailshilkov mikhailshilkov added this to the 0.76 milestone Jul 25, 2022
@dixler dixler mentioned this issue Aug 8, 2022
3 tasks
@t0yv0
Copy link
Member Author

t0yv0 commented Aug 9, 2022

Idea from @pawelprazak : -d, --debug flag may possibly be relevant here.

@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants