milvus-io/milvus-sdk-java

Error occurred after version upgrade

Closed this issue · 10 comments

This error occurred when I upgraded Springboot version to 3.1.6,But using version 3.1.5 does not have this issue, while the Java SDK version is 2.2.11
2023-12-06 15:28:19.190 [XNIO-1 task-2] ERROR io.milvus.client.AbstractMilvusGrpcClient - HasPartitionRequest RPC failed!
io.grpc.StatusRuntimeException: UNKNOWN
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
at io.milvus.grpc.MilvusServiceGrpc$MilvusServiceBlockingStub.hasPartition(MilvusServiceGrpc.java:4198)
at io.milvus.client.AbstractMilvusGrpcClient.hasPartition(AbstractMilvusGrpcClient.java:975)
at io.milvus.client.MilvusServiceClient.lambda$hasPartition$18(MilvusServiceClient.java:388)
at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:259)
at io.milvus.client.MilvusServiceClient.hasPartition(MilvusServiceClient.java:388)
at com.zstech.milvusplus.util.MilvusUtil.hasPartition(MilvusUtil.java:189)
at com.zstech.milvusplus.util.MilvusUtil.getExistPartitionNames(MilvusUtil.java:415)
at com.zstech.milvusplus.util.MilvusUtil.search(MilvusUtil.java:508)

我也遇到了,springboot 3.1.5 正常 3.1.6 和 3.2.0 就不正常了

I can confirm it as well! Milvus Java client is unusable (for me) at the moment.
UPDATE: see my workaround below.

/assign @yhmo
could you help on this one?
I guess this is due to some dependency issue

Looks like the problem comes with the io.netty:netty-codec-http2 dependency!
By default Spring Boot 3.2.0 uses latest version: 4.1.101.Final. Later cause the milvus client to crash with the above error.

My workaround was to downgrade io.netty:netty-codec-http2 to 4.1.100.Final, by adding it explicitly to my pom:

    <dependency>
	    <groupId>io.netty</groupId>
	    <artifactId>netty-codec-http2</artifactId>
	    <version>4.1.100.Final</version>
    </dependency>

Additionally to avoid some security vulnerabilities caused by theoutdated milvus (grpc/netty) dependecies you can try this:

<dependency>
	<groupId>io.milvus</groupId>
	<artifactId>milvus-sdk-java</artifactId>
	<version>2.3.3</version>
	<exclusions>
		<exclusion>
			<groupId>io.netty</groupId>
			<artifactId>netty-codec</artifactId>
		</exclusion>
		<exclusion>
			<groupId>io.netty</groupId>
			<artifactId>netty-codec-http2</artifactId>
		</exclusion>
	</exclusions>
</dependency>

<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-codec</artifactId>
	<version>4.1.101.Final</version>
</dependency>
<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-codec-http2</artifactId>
	<version>4.1.100.Final</version>
</dependency>

hope this helps.

yhmo commented

To support TLS connection, java sdk introduces a dependency grpc-netty from v2.2.10: https://github.com/milvus-io/milvus-sdk-java/blob/master/src/main/java/io/milvus/client/MilvusServiceClient.java#L93

In the Java sdk pom.xml we can see:

        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty</artifactId>
            <version>${grpc.version}</version>
        </dependency>

The version of grpc-netty is consistent with the grpc lib version. Milvus is using grpc 1.46 to build sdk for client-side and api for server-side, so we can't change this version.

This error is caused by incompatible versions of user's pre-installed netty lib and the java sdk grpc-netty lib. So far I don't have a perfect solution to fix it. Thanks @tzolov for the workaround.

yhmo commented

I have verified that upgrading the java sdk's grpc dependency from 1.46 to 1.59.1 can avoid these errors.
I need to do some testing. I will upgrade grpc version to 1.59.1 in the next sdk version if no compatible issues are found.

yhmo commented

The #713 and #713 has upgraded the grpc to 1.59.1

When is the next SDK version expected to be released

yhmo commented

When is the next SDK version expected to be released

2.3.4 already released