pulumi / pulumi-java

Java support for Pulumi
Apache License 2.0
69 stars 21 forks source link

Program hangs indefinitely if provider is specified before Pulumi dependency in pom.xml #812

Open jkodroff opened 2 years ago

jkodroff commented 2 years ago

The following Pulumi program hangs indefinitely on my machine:

package myproject;

import com.pulumi.Pulumi;
import com.pulumi.azurenative.resources.ResourceGroup;
import com.pulumi.azurenative.storage.StorageAccount;
import com.pulumi.azurenative.storage.StorageAccountArgs;
import com.pulumi.azurenative.storage.inputs.SkuArgs;
import com.pulumi.azurenative.storage.enums.Kind;
import com.pulumi.azurenative.storage.enums.SkuName;
import com.pulumi.azurenative.storage.StorageAccountStaticWebsite;
import com.pulumi.azurenative.storage.StorageAccountStaticWebsiteArgs;
import com.pulumi.azurenative.storage.Blob;
import com.pulumi.azurenative.storage.BlobArgs;
import com.pulumi.asset.FileAsset;

public class App {
    public static void main(String[] args) {
        Pulumi.run(ctx -> {
            var resourceGroup = new ResourceGroup("app");

            var storageAccount = new StorageAccount("app", StorageAccountArgs.builder()
                    .enableHttpsTrafficOnly(true)
                    .kind(Kind.StorageV2)
                    .resourceGroupName(resourceGroup.name())
                    .sku(SkuArgs.builder()
                            .name(SkuName.Standard_LRS)
                            .build())
                    .build());

            var staticWebsite = new StorageAccountStaticWebsite("app",
                    StorageAccountStaticWebsiteArgs.builder()
                            .accountName(storageAccount.name())
                            .resourceGroupName(resourceGroup.name())
                            .indexDocument("index.html")
                            .error404Document("404.html")
                            .build());

            var files = new String[] { "index.html", "404.html" };
            for (var file : files) {
                new Blob(file, BlobArgs.builder()
                        .resourceGroupName(resourceGroup.name())
                        .accountName(storageAccount.name())
                        .containerName(staticWebsite.containerName())
                        .source(new FileAsset("../wwwroot/" + file))
                        .contentType("text/html")
                        .build());
            }
        });
    }
}

pulumi up --logtostderr --logflow -v=9 2> out.txt output (I let it go until it stopped producing additional logged output, then hit ctrl-c):

I0817 11:26:42.752665   99357 backend.go:420] found username for access token
I0817 11:26:43.130145   99357 util.go:564] errors detecting git metadata: 2 errors occurred:
    * detecting Git remote URL: could not read origin information: remote not found
    * getting repository HEAD: reference not found

I0817 11:26:43.223308   99357 backend.go:420] found username for access token
I0817 11:26:43.325765   99357 ignore.go:44] Explicitly ignoring and discarding error: could not read origin information: remote not found
I0817 11:26:43.431518   99357 backend.go:420] found username for access token
I0817 11:26:43.431098   99357 backend.go:974] Stack dev being updated to version 2
I0817 11:26:43.616713   99357 update.go:190] *** Starting Update(preview=true) ***
I0817 11:26:43.617134   99357 plugins.go:120] gatherPluginsFromProgram(): gathering plugins from language host
I0817 11:26:43.618085   99357 plugins.go:1439] GetPluginPath(language, java, <nil>): found on $PATH /opt/homebrew/bin/pulumi-language-java
I0817 11:26:43.618207   99357 plugin.go:184] Launching plugin 'java' from '/opt/homebrew/bin/pulumi-language-java' with args: -root=/Users/jkodroff/tmp/my-first-azure-app,127.0.0.1:62180
I0817 11:26:43.689755   99357 langruntime_plugin.go:202] langhost[java].GetPluginInfo() executing
I0817 11:26:43.691128   99357 langruntime_plugin.go:111] langhost[java].GetRequiredPlugins(proj=my-first-azure-app,pwd=/Users/jkodroff/tmp/my-first-azure-app,program=.) executing
I0817 11:26:43.691472   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:43.691456   99358 main.go:150] GetRequiredPlugins: program=.
<{%reset%}>)
I0817 11:26:43.691515   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:43.691463   99358 main.go:188] GetRequiredPlugins: Determining Pulumi plugins
<{%reset%}>)
I0817 11:26:43.691558   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:43.691550   99358 main.go:228] Language host launching process:  /opt/homebrew/bin/mvn -Dorg.slf4j.simpleLogger.logFile=System.err --no-transfer-progress compile exec:java -DmainClass=com.pulumi.bootstrap.internal.Main -DmainArgs=packages
<{%reset%}>)
I0817 11:26:45.375849   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.375758   99358 main.go:257] '/opt/homebrew/bin/mvn -Dorg.slf4j.simpleLogger.logFile=System.err --no-transfer-progress compile exec:java -DmainClass=com.pulumi.bootstrap.internal.Main -DmainArgs=packages' completed successfully
<{%reset%}>)
I0817 11:26:45.375913   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.375795   99358 main.go:206] GetRequiredPlugins: bootstrap raw output=[{"resource":true,"name":"azure-native","version":"1.64.0"}]
<{%reset%}>)
I0817 11:26:45.375951   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.375876   99358 main.go:163] GetRequiredPlugins: Determining plugin dependency: azure-native, 1.64.0
<{%reset%}>)
I0817 11:26:45.376600   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.375883   99358 main.go:180] GetRequiredPlugins: plugins=[name:"azure-native" kind:"resource" version:"1.64.0"]
<{%reset%}>)
I0817 11:26:45.377460   99357 langruntime_plugin.go:153] langhost[java].GetRequiredPlugins(proj=my-first-azure-app,pwd=/Users/jkodroff/tmp/my-first-azure-app,program=.) success: #versions=1
I0817 11:26:45.377475   99357 plugins.go:132] gatherPluginsFromProgram(): plugin java <nil> () is required by language host
I0817 11:26:45.377496   99357 plugins.go:132] gatherPluginsFromProgram(): plugin azure-native 1.64.0 () is required by language host
I0817 11:26:45.377695   99357 plugins.go:144] gatherPluginsFromSnapshot(): gathering plugins from snapshot
I0817 11:26:45.377723   99357 plugins.go:181] ensurePluginsAreInstalled(): beginning
I0817 11:26:45.377794   99357 plugins.go:1439] GetPluginPath(language, java, <nil>): found on $PATH /opt/homebrew/bin/pulumi-language-java
I0817 11:26:45.377809   99357 plugins.go:186] ensurePluginsAreInstalled(): plugin java <nil> already installed
I0817 11:26:45.378762   99357 plugins.go:1486] GetPluginPath(resource, azure-native, 1.64.0): enabling new plugin behavior
I0817 11:26:45.379029   99357 plugins.go:1570] SelectCompatiblePlugin(..., azure-native): beginning
I0817 11:26:45.379046   99357 plugins.go:1599] SelectCompatiblePlugin(..., azure-native): best plugin azure-native-1.64.0: semver match
I0817 11:26:45.379052   99357 plugins.go:1612] SelectCompatiblePlugin(..., azure-native): selecting plugin 'azure-native-1.64.0': best match 
I0817 11:26:45.379080   99357 plugins.go:1529] GetPluginPath(resource, azure-native, 1.64.0): found in cache at /Users/jkodroff/.pulumi/plugins/resource-azure-native-v1.64.0/pulumi-resource-azure-native
I0817 11:26:45.379087   99357 plugins.go:186] ensurePluginsAreInstalled(): plugin azure-native 1.64.0 already installed
I0817 11:26:45.379092   99357 plugins.go:201] ensurePluginsAreInstalled(): completed
I0817 11:26:45.379120   99357 plugins.go:310] computeDefaultProviderPlugins(): considering java
I0817 11:26:45.379131   99357 plugins.go:313] computeDefaultProviderPlugins(): skipping java, not a resource provider
I0817 11:26:45.379137   99357 plugins.go:310] computeDefaultProviderPlugins(): considering azure-native-1.64.0
I0817 11:26:45.379147   99357 plugins.go:341] computeDefaultProviderPlugins(): plugin azure-native-1.64.0 selected for package azure-native (first seen)
I0817 11:26:45.379154   99357 plugins.go:347] computeDefaultProviderPlugins(): summary of default plugins:
I0817 11:26:45.379161   99357 plugins.go:349]   azure-native    = 1.64.0
I0817 11:26:45.380123   99357 step_generator.go:1143] stepGenerator.GeneratePendingDeletes(): scanning previous snapshot for pending deletes
I0817 11:26:45.380158   99357 deployment_executor.go:475] deploymentExecutor.retirePendingDeletes(...): no pending deletions
I0817 11:26:45.380196   99357 deployment_executor.go:256] deploymentExecutor.Execute(...): waiting for incoming events
I0817 11:26:45.380226   99357 step_executor.go:389] StepExecutor worker(-2): worker coming online
I0817 11:26:45.380234   99357 step_executor.go:389] StepExecutor worker(-2): worker waiting for incoming chains
I0817 11:26:45.380438   99357 langruntime_plugin.go:163] langhost[java].Run(pwd=/Users/jkodroff/tmp/my-first-azure-app,program=.,#args=0,proj=my-first-azure-app,stack=dev,#config=0,dryrun=true) executing
I0817 11:26:45.381286   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.381235   99358 main.go:265] Run: program=.
<{%reset%}>)
I0817 11:26:45.381362   99357 eventsink.go:78] eventSink::Infoerr(<{%reset%}>I0817 11:26:45.381248   99358 main.go:289] Language host launching process:  /opt/homebrew/bin/mvn -Dorg.slf4j.simpleLogger.defaultLogLevel=warn --no-transfer-progress compile exec:java
<{%reset%}>)
I0817 11:27:51.643958   99357 deployment_executor.go:156] deploymentExecutor.Execute(...): signalling cancellation to providers...
I0817 11:27:51.644279   99357 step_executor.go:389] StepExecutor worker(-2): worker exiting due to cancellation
I0817 11:27:51.643949   99357 deployment_executor.go:294] deploymentExecutor.Execute(...): context finished: context canceled
I0817 11:27:51.644786   99357 step_executor.go:389] StepExecutor worker(-1): StepExecutor.waitForCompletion(): waiting for worker threads to exit
I0817 11:27:51.648287   99357 step_executor.go:389] StepExecutor worker(-1): StepExecutor.waitForCompletion(): worker threads all exited
I0817 11:27:51.648345   99357 deployment_executor.go:304] deploymentExecutor.Execute(...): step executor has completed
I0817 11:27:51.649306   99357 eventsink.go:86] eventSink::Error(<{%reset%}>preview canceled<{%reset%}>)
I0817 11:27:51.653549   99357 langruntime_plugin.go:188] langhost[java].Run(pwd=/Users/jkodroff/tmp/my-first-azure-app,program=.,...,dryrun=true) failed: err=error reading from server: read tcp 127.0.0.1:62183->127.0.0.1:62181: use of closed network connection
I0817 11:27:51.654671   99357 ignore.go:44] Explicitly ignoring and discarding error: rpc error: code = Canceled desc = grpc: the client connection is closing
I0817 11:27:51.654931   99357 ignore.go:44] Explicitly ignoring and discarding error: 1 error occurred:
    * operation not permitted

I0817 11:27:51.655780   99357 source_eval.go:187] EvalSourceIterator ended with an error: error reading from server: read tcp 127.0.0.1:62183->127.0.0.1:62181: use of closed network connection
I0817 11:27:51.656012   99357 deployment_executor.go:241] deploymentExecutor.Execute(...): incoming events goroutine exiting
I0817 11:27:51.672432   99357 update.go:193] *** Update(preview=true) complete ***

pulumi about output:

➜  my-first-azure-app git:(main) ✗ pulumi about
CLI
Version      3.38.0
Go Version   go1.19
Go Compiler  gc

Plugins
NAME          VERSION
azure-native  1.64.0
java          unknown

Host
OS       darwin
Version  12.5
Arch     arm64

This project is written in java: executable='/usr/bin/java' version='openjdk 18.0.1 2022-04-19
OpenJDK Runtime Environment Homebrew (build 18.0.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.1+0, mixed mode, sharing)' maven='Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)' gradle='7.4.2' java='/usr/bin/java' javac='18.0.1'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name           pulumi.com
URL            https://app.pulumi.com/jkodroff
User           jkodroff
Organizations  jkodroff, pulumi

No dependencies found

Pulumi locates its logs in /var/folders/5m/4n1x3f8151s35wc80w06z5k80000gn/T/ by default
jkodroff commented 2 years ago

Also, here's the only addition to my pom.xml from what I had from pulumi new java:

        <dependency>
            <groupId>com.pulumi</groupId>
            <artifactId>azure-native</artifactId>
            <version>(,2.0]</version>
        </dependency>
dixler commented 2 years ago

It seems that the only difference between my working version and @jkodroff hanging version is this diff. and swapping the order resolves it.

% diff --side-by-side pom.xml pom.josh.xml
<?xml version="1.0" encoding="UTF-8"?>              <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"      <project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.            xsi:schemaLocation="http://maven.apache.org/POM/4.0.
    <modelVersion>4.0.0</modelVersion>                  <modelVersion>4.0.0</modelVersion>

    <groupId>com.pulumi</groupId>                   <groupId>com.pulumi</groupId>
    <artifactId>java</artifactId>                 |     <artifactId>my-first-azure-app</artifactId>
    <version>1.0-SNAPSHOT</version>                 <version>1.0-SNAPSHOT</version>

    <properties>                            <properties>
        <encoding>UTF-8</encoding>                      <encoding>UTF-8</encoding>
        <maven.compiler.source>11</maven.compiler.source>           <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>           <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.release>11</maven.compiler.release>         <maven.compiler.release>11</maven.compiler.release>
        <mainClass>myproject.App</mainClass>                    <mainClass>myproject.App</mainClass>
        <mainArgs/>                             <mainArgs/>
    </properties>                           </properties>

    <dependencies>                          <dependencies>
        <dependency>                                <dependency>
            <groupId>com.pulumi</groupId>                       <groupId>com.pulumi</groupId>
            <artifactId>pulumi</artifactId>           |             <artifactId>azure-native</artifactId>
            <version>(,1.0]</version>                 |             <version>(,2.0]</version>
        </dependency>                               </dependency>
        <dependency>                                <dependency>
            <groupId>com.pulumi</groupId>                       <groupId>com.pulumi</groupId>
            <artifactId>azure-native</artifactId>         |             <artifactId>pulumi</artifactId>
            <version>(,2.0]</version>                 |             <version>(,1.0]</version>
        </dependency>                               </dependency>
    </dependencies>                         </dependencies>

    <build>                             <build>
        <plugins>                               <plugins>
            <plugin>                                    <plugin>
                <groupId>org.apache.maven.plugins</groupId>                 <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>                   <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>                            <version>3.2.2</version>
                <configuration>                                 <configuration>
                    <archive>                                       <archive>
                        <manifest>                                      <manifest>
                            <addClasspath>true</addClasspath>                               <addClasspath>true</addClasspath>
                            <mainClass>${mainClass}</mainClas                               <mainClass>${mainClass}</mainClas
                        </manifest>                                     </manifest>
                    </archive>                                      </archive>
                </configuration>                                </configuration>
            </plugin>                                   </plugin>
            <plugin>                                    <plugin>
                <groupId>org.apache.maven.plugins</groupId>                 <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId                   <artifactId>maven-assembly-plugin</artifactId
                <version>3.3.0</version>                            <version>3.3.0</version>
                <configuration>                                 <configuration>
                    <archive>                                       <archive>
                        <manifest>                                      <manifest>
                            <addClasspath>true</addClasspath>                               <addClasspath>true</addClasspath>
                            <mainClass>${mainClass}</mainClas                               <mainClass>${mainClass}</mainClas
                        </manifest>                                     </manifest>
                    </archive>                                      </archive>
                    <descriptorRefs>                                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies<                           <descriptorRef>jar-with-dependencies<
                    </descriptorRefs>                                   </descriptorRefs>
                </configuration>                                </configuration>
                <executions>                                    <executions>
                    <execution>                                     <execution>
                        <id>make-my-jar-with-dependencies</id                           <id>make-my-jar-with-dependencies</id
                        <phase>package</phase>                                  <phase>package</phase>
                        <goals>                                         <goals>
                            <goal>single</goal>                                     <goal>single</goal>
                        </goals>                                        </goals>
                    </execution>                                    </execution>
                </executions>                                   </executions>
            </plugin>                                   </plugin>
            <plugin>                                    <plugin>
                <groupId>org.codehaus.mojo</groupId>                        <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>                  <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>                            <version>3.0.0</version>
                <configuration>                                 <configuration>
                    <mainClass>${mainClass}</mainClass>                         <mainClass>${mainClass}</mainClass>
                    <commandlineArgs>${mainArgs}</commandline                       <commandlineArgs>${mainArgs}</commandline
                </configuration>                                </configuration>
            </plugin>                                   </plugin>
            <plugin>                                    <plugin>
                <groupId>org.apache.maven.plugins</groupId>                 <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-wrapper-plugin</artifactId>                   <artifactId>maven-wrapper-plugin</artifactId>
                <version>3.1.0</version>                            <version>3.1.0</version>
                <configuration>                                 <configuration>
                    <mavenVersion>3.8.5</mavenVersion>                          <mavenVersion>3.8.5</mavenVersion>
                </configuration>                                </configuration>
            </plugin>                                   </plugin>
        </plugins>                              </plugins>
    </build>                                </build>
jkodroff commented 2 years ago

With com.pulumi.pulumi first:

$ mvn dependency:tree
[INFO] com.pulumi:my-first-azure-app:jar:1.0-SNAPSHOT
[INFO] +- com.pulumi:pulumi:jar:0.5.4:compile
[INFO] |  +- io.grpc:grpc-protobuf:jar:1.38.0:runtime
[INFO] |  |  +- io.grpc:grpc-api:jar:1.38.0:runtime
[INFO] |  |  |  \- io.grpc:grpc-context:jar:1.38.0:runtime
[INFO] |  |  +- com.google.api.grpc:proto-google-common-protos:jar:2.0.1:runtime
[INFO] |  |  +- io.grpc:grpc-protobuf-lite:jar:1.38.0:runtime
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.4.0:compile
[INFO] |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.19:runtime
[INFO] |  +- io.grpc:grpc-stub:jar:1.38.0:runtime
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- net.javacrumbs.future-converter:future-converter-java8-guava:jar:1.2.0:runtime
[INFO] |  |  +- net.javacrumbs.future-converter:future-converter-common:jar:1.2.0:runtime
[INFO] |  |  +- net.javacrumbs.future-converter:future-converter-java8-common:jar:1.2.0:runtime
[INFO] |  |  \- net.javacrumbs.future-converter:future-converter-guava-common:jar:1.2.0:runtime
[INFO] |  +- com.google.guava:guava:jar:31.1-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:3.12.0:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.8.9:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.21.1:runtime
[INFO] |  +- com.google.protobuf:protobuf-java-util:jar:3.21.1:runtime
[INFO] |  \- io.grpc:grpc-netty-shaded:jar:1.38.0:runtime
[INFO] |     \- io.grpc:grpc-core:jar:1.38.0:runtime (version selected from constraint [1.38.0,1.38.0])
[INFO] |        +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO] |        \- io.perfmark:perfmark-api:jar:0.23.0:runtime
[INFO] \- com.pulumi:azure-native:jar:1.63.0:compile

With azure-native first:

$ mvn dependency:tree
➜  my-first-azure-app git:(main) ✗ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.pulumi:my-first-azure-app >--------------------
[INFO] Building my-first-azure-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ my-first-azure-app ---
[INFO] com.pulumi:my-first-azure-app:jar:1.0-SNAPSHOT
[INFO] +- com.pulumi:azure-native:jar:1.63.0:compile
[INFO] |  +- com.google.guava:guava:jar:30.1-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:3.5.0:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.12.0:runtime
[INFO] |  \- com.google.protobuf:protobuf-java-util:jar:3.12.0:runtime
[INFO] \- com.pulumi:pulumi:jar:0.5.4:compile
[INFO]    +- io.grpc:grpc-protobuf:jar:1.38.0:runtime
[INFO]    |  +- io.grpc:grpc-api:jar:1.38.0:runtime
[INFO]    |  |  \- io.grpc:grpc-context:jar:1.38.0:runtime
[INFO]    |  +- com.google.api.grpc:proto-google-common-protos:jar:2.0.1:runtime
[INFO]    |  +- io.grpc:grpc-protobuf-lite:jar:1.38.0:runtime
[INFO]    |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.19:runtime
[INFO]    +- io.grpc:grpc-stub:jar:1.38.0:runtime
[INFO]    +- net.javacrumbs.future-converter:future-converter-java8-guava:jar:1.2.0:runtime
[INFO]    |  +- net.javacrumbs.future-converter:future-converter-common:jar:1.2.0:runtime
[INFO]    |  +- net.javacrumbs.future-converter:future-converter-java8-common:jar:1.2.0:runtime
[INFO]    |  \- net.javacrumbs.future-converter:future-converter-guava-common:jar:1.2.0:runtime
[INFO]    \- io.grpc:grpc-netty-shaded:jar:1.38.0:runtime
[INFO]       \- io.grpc:grpc-core:jar:1.38.0:runtime (version selected from constraint [1.38.0,1.38.0])
[INFO]          +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO]          \- io.perfmark:perfmark-api:jar:0.23.0:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.466 s
[INFO] Finished at: 2022-08-18T13:11:24-04:00
pawelprazak commented 2 years ago

Thank you for your report. This is a very interesting find.

After brief discussion with @t0yv0 we believe this is a transient dependency issue that surfaced with netty implementation of gRPC. If we are right, the classpath somehow has two gRPC versions and the netty one gets priority under very specific circumstances. But it might be something else as well.

And I agree this is very unfortunate and hard to debug problem.

t0yv0 commented 2 years ago

I think that the path to resolution here would be exclusions. Currently on main, we apply exclusions to Pulumi Java SDK, so that transitive dependencies are consistent. We might need to also automatically apply exclusions to auto-generated build files for Pulumi Java providers similarly, so transitive dependencies of programs using Pulumi+Providers are consistent. This can be checked by the Maven Enforcer plugin. Once we get to a project with a provider that has consistent transient dependencies we should verify that:

  1. switching pom order does not change the output of mvn dependency:tree

  2. the example code works as expected

This is quite a bit of legwork but worth pursuing at some point to get the best experience for Pulumi Java users.