milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: use standalone v2.2.3 and java 2.2.3 sdk, function milvusClient.hasCollection cause error

Open bjgyl opened this issue 3 years ago • 9 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version:2.2.3
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka): 默认   
- SDK version(e.g. pymilvus v2.0.0rc2): java 2.2.3
- OS(Ubuntu or CentOS): CentOS
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

1.通过docker-compose方式部署了2.2.3版 standalone 的milvus; 2.使用java sdk 2.2.3版本,pom依赖如下: groupId:io.milvus</groupId> artifactId:milvus-sdk-java version:2.2.3 3.调用判断collection是否存在的方法: R<Boolean> respHasCollection = milvusClient.hasCollection(HasCollectionParam.newBuilder().withCollectionName(collectionName).build());

Expected Behavior

应该正常返回结果

Steps To Reproduce

调用R<Boolean> respHasCollection = milvusClient.hasCollection(HasCollectionParam.newBuilder().withCollectionName(collectionName).build());
报异常

Milvus Log

io.milvus.client.AbstractMilvusGrpcClient |2428 ||||HasCollectionParam{collectionName='image_feature_info'} io.grpc.stub.ClientCalls$ThreadlessExecutor |742 ||||Runnable threw exception java.lang.NoSuchMethodError: com.google.protobuf.GeneratedMessageV3.isStringEmpty(Ljava/lang/Object;)Z at io.milvus.grpc.HasCollectionRequest.getSerializedSize(HasCollectionRequest.java:237) at io.grpc.protobuf.lite.ProtoInputStream.available(ProtoInputStream.java:108) at io.grpc.internal.MessageFramer.getKnownLength(MessageFramer.java:205) at io.grpc.internal.MessageFramer.writePayload(MessageFramer.java:137) at io.grpc.internal.AbstractStream.writeMessage(AbstractStream.java:65) at io.grpc.internal.ForwardingClientStream.writeMessage(ForwardingClientStream.java:37) at io.grpc.internal.DelayedStream$6.run(DelayedStream.java:257) at io.grpc.internal.DelayedStream.drainPendingCalls(DelayedStream.java:163) at io.grpc.internal.DelayedStream.setStream(DelayedStream.java:132) at io.grpc.internal.DelayedClientTransport$PendingStream.createRealStream(DelayedClientTransport.java:358) at io.grpc.internal.DelayedClientTransport$PendingStream.access$300(DelayedClientTransport.java:341) at io.grpc.internal.DelayedClientTransport$5.run(DelayedClientTransport.java:300) at io.grpc.stub.ClientCalls$ThreadlessExecutor.waitAndDrain(ClientCalls.java:740) at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:149) at io.milvus.grpc.MilvusServiceGrpc$MilvusServiceBlockingStub.hasCollection(MilvusServiceGrpc.java:3658) at io.milvus.client.AbstractMilvusGrpcClient.hasCollection(AbstractMilvusGrpcClient.java:320) at com.client.MilvusDataBaseClient.createCollection(MilvusDataBaseClient.java:134) at com.client.MilvusDataBaseClient.init(MilvusDataBaseClient.java:507) ………………………………

Anything else?

经过测试,2.2.2版本的java sdk,可以正常操作2.2.3的milvus

bjgyl avatar Feb 17 '23 07:02 bjgyl

/assign @yhmo /unassign

yanliang567 avatar Feb 17 '23 09:02 yanliang567

"java.lang.NoSuchMethodError: com.google.protobuf.GeneratedMessageV3.isStringEmpty" is caused by a redundant proto file "proto/google/protobuf/descriptor.proto" in previous version of milvus-proto repo. The milvus repo uses milvus-proto as to generate server side rpc classes. We removed the "proto/google/protobuf/descriptor.proto" by [this commit](https://github.com/milvus-io/milvus-proto/commit/d8cfcb4d86bd0720258351b4b4641778e30cb62e). But looks like the milvus v2.2.3 still use an old version of milvus-proto to generate rpc classes.

yhmo avatar Feb 19 '23 14:02 yhmo

@bjgyl 我用standalone v2.2.3 and java 2.2.3 sdk试了一下,并没有出现你说的问题。

yhmo avatar Feb 21 '23 03:02 yhmo

今天刚试用,碰到同样的问题,也是 2.2.3 版本 Caused by: java.lang.NoSuchMethodError: 'boolean com.google.protobuf.GeneratedMessageV3.isStringEmpty(java.lang.Object)' at io.milvus.grpc.CollectionSchema.getSerializedSize(CollectionSchema.java:220) at com.google.protobuf.AbstractMessageLite.toByteString(AbstractMessageLite.java:58) at io.milvus.client.AbstractMilvusGrpcClient.createCollection(AbstractMilvusGrpcClient.java:378)

rokaye avatar Mar 08 '23 05:03 rokaye

@yhmo could you help on check it~

xiaofan-luan avatar Mar 10 '23 11:03 xiaofan-luan

今天刚试用,碰到同样的问题,也是 2.2.3 版本 Caused by: java.lang.NoSuchMethodError: 'boolean com.google.protobuf.GeneratedMessageV3.isStringEmpty(java.lang.Object)' at io.milvus.grpc.CollectionSchema.getSerializedSize(CollectionSchema.java:220) at com.google.protobuf.AbstractMessageLite.toByteString(AbstractMessageLite.java:58) at io.milvus.client.AbstractMilvusGrpcClient.createCollection(AbstractMilvusGrpcClient.java:378)

Milvus 和 Java SDK都是 2.2.3版本?

yhmo avatar Mar 10 '23 11:03 yhmo

@rokaye @yhmo Solution to fix your problem Caused by: java.lang.NoSuchMethodError: 'boolean com.google.protobuf.GeneratedMessageV3.isStringEmpty(java.lang.Object)' at io.milvus.grpc.CollectionSchema.getSerializedSize(CollectionSchema.java:220) at com.google.protobuf.AbstractMessageLite.toByteString(AbstractMessageLite.java:58) at io.milvus.client.AbstractMilvusGrpcClient.createCollection(AbstractMilvusGrpcClient.java:378)

1.exclude protobuf-java-util from milvus-sdk

    compile ('io.milvus:milvus-sdk-java:2.2.3') {
        exclude group: 'com.google.protobuf', module: 'protobuf-java-util'
    }

2.use later version of protobuf-java package

compile ('com.google.protobuf:protobuf-java:3.19.1')

batch-norm avatar Mar 16 '23 07:03 batch-norm

@batch-norm
Your solutions were effective. Use protobuf-java:3.19.1+ can solve the problem by testing . Even do not need to exclude protobuf-java-util from milvus-sdk。

pom.xml: <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>3.19.1</version> </dependency>

yongpengli-z avatar Mar 22 '23 09:03 yongpengli-z

Java sdk 2.2.4 has been released, I suppose this version can resolve this compatible problem. https://github.com/milvus-io/milvus-sdk-java/releases/tag/v2.2.4

yhmo avatar Apr 02 '23 14:04 yhmo