etcd-io / jetcd

etcd java client
Apache License 2.0
1.08k stars 314 forks source link

not resoponse when runiing in jdk21 #1338

Closed qiaofazhan closed 3 months ago

qiaofazhan commented 3 months ago

Versions

Describe the bug progrem code like this: GetOption op = GetOption.newBuilder().isPrefix(true).build(); CompletableFuture getFuture= EtcdFactory.getKVClient().get(EtcdFactory.bytesOf(EtcdConstant.KEYPREFIX_PRODUCER),op); GetResponse response = null; try { response = getFuture.get();//keep blocking in java21 } catch (InterruptedException e) { log.error(Constant.LOG_ERR_PRE+"find etcd producer data error",e); throw new RuntimeException(e); } catch (ExecutionException e) { log.error(Constant.LOG_ERR_PRE+"find etcd producer data error",e); throw new RuntimeException(e); } List list = response.getKvs();

//////////////////////// The above code works fine in java8; When upgrading java8 to java21, the above code will keep blocking the CompletableFuture get method; To Reproduce Run the above code in java21;

Expected behavior CompletableFuture can be returned normally

Additional context

qiaofazhan commented 3 months ago

I solved this problem by upgrading GRPC-related dependencies. jetcd has also been upgraded to version 7.7

grpc-netty io.grpc 1.62.2 guava com.google.guava
    <dependency>
        <artifactId>grpc-protobuf</artifactId>
        <groupId>io.grpc</groupId>
        <version>1.62.2</version>
        <exclusions>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
            <exclusion>
                <artifactId>protobuf-java</artifactId>
                <groupId>com.google.protobuf</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <artifactId>grpc-stub</artifactId>
        <groupId>io.grpc</groupId>
        <version>1.62.2</version>
        <exclusions>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <artifactId>grpc-util</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
        </exclusions>
        <groupId>io.grpc</groupId>
        <version>1.62.2</version>
    </dependency>
    <dependency>
        <artifactId>grpc-core</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
        </exclusions>
        <groupId>io.grpc</groupId>
        <version>1.62.2</version>
    </dependency>
qiaofazhan commented 3 months ago

您好,邮件已收到,尽快给您回复。