v6: the "all" jar leaves com.google.rpc/api/type unrelocated but compiled against the shaded protobuf

Đang mở
#632 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
grpc, java
Lĩnh vực
backend, build-system

Hướng nghiên cứu

Start by locating the build configuration that creates the all classifier jar and inspect its protobuf relocation rules. Reproduce the classpath conflict with the Java snippet and dependency versions in the issue, then trace which packaged classes remain under com.google.*. Done means the all jar no longer exposes those classes with bytecode linked to shaded protobuf, and the reproduction works with either classpath order.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

The all classifier jar relocates protobuf to io.weaviate.shaded.com.google.protobuf, but keeps com.google.rpc.*, com.google.api.*, com.google.type.* and com.google.longrunning.* (from proto-google-common-protos, about 940 classes) under their original package names, with their bytecode rewritten to extend the shaded protobuf.

Any application that also has proto-google-common-protos on its classpath ends up with two incompatible classes of the same name. That includes anything using gRPC's grpc-protobuf or a Google Cloud client library. Whichever jar comes first wins, and the other side breaks.

Reproduction (client6-6.3.2-all.jar, JDK 17)

Object s = com.google.rpc.Status.newBuilder().setCode(5).build();
System.out.println(s.getClass().getSuperclass().getName());
System.out.println(s instanceof com.google.protobuf.Message);
Classpath order superclass instanceof Message
client6-6.3.2-all.jar, proto-google-common-protos-2.62.0, protobuf-java-3.25.8 io.weaviate.shaded.com.google.protobuf.GeneratedMessageV3 false
proto-google-common-protos-2.62.0, protobuf-java-3.25.8, client6-6.3.2-all.jar com.google.protobuf.GeneratedMessageV3 true

The jar also carries unrelocated Guava, Gson, Nimbus JOSE/OAuth, Apache HttpClient 5 and commons-lang3, which can collide the same way in any application that has its own versions of them.

Expected

Relocate everything that is compiled against the shaded protobuf (at least com.google.rpc, com.google.api, com.google.type, com.google.longrunning), and ideally the other bundled libraries too. Otherwise the all jar is only safe in an application with no other Google/gRPC dependencies.

Related but separate: #422.

Ngôn ngữ chính
Java
Star
34
Fork
31
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của weaviate/java-client

Tất cả issue của weaviate/java-client

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.