Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with binary compatibility with older grpc versions at runtime in the client #3997

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Jun 20, 2023

Motivation

Changes

  • make the field type NameResolverProvider instead of DnsNameResolverProvider
    • this prevents possible NoSuchMethodError errors about DnsNameResolverProvider.newNameResolver method

…me in the bookkeeper client.

- prevent possible NoSuchMethodError errors about DnsNameResolverProvider.newNameResolver method
  see grpc/grpc-java@fcb5c54#diff-b04e884de51ed12ff79482f600a2d4ec18e405ee189a4952ae35f4d2742b7160L50
lhotari referenced this pull request in grpc/grpc-java Jun 20, 2023
…#2) (#9812)

This change has these main aspects to it:

1. Removal of any name resolution responsibility from ManagedChannelImpl
2. Creation of a new RetryScheduler to own generic retry logic
     - Can also be used outside the name resolution context
3. Creation of a new RetryingNameScheduler that can be used to wrap any
   polling name resolver to add retry capability
4. A new facility in NameResolver to allow implementations to notify
   listeners on the success of name resolution attempts
     - RetryingNameScheduler relies on this
@zymap zymap added dependencies Pull requests that update a dependency file release/4.16.2 labels Jun 21, 2023
@zymap zymap added this to the 4.17.0 milestone Jun 21, 2023
@zymap zymap merged commit ffc8e8b into apache:master Jun 21, 2023
18 checks passed
zymap pushed a commit that referenced this pull request Jun 21, 2023
…me in the bookkeeper client. (#3997)

### Motivation

- grpc version was upgraded to 1.56.0 in #3992
- that breaks binary compatibility for DnsNameResolverProvider class
  - see grpc/grpc-java@fcb5c54#diff-b04e884de51ed12ff79482f600a2d4ec18e405ee189a4952ae35f4d2742b7160L50

### Changes

- make the field type NameResolverProvider instead of DnsNameResolverProvider
  - this prevents possible NoSuchMethodError errors about DnsNameResolverProvider.newNameResolver method

(cherry picked from commit ffc8e8b)
@lhotari
Copy link
Member Author

lhotari commented Jun 21, 2023

This PR will also be useful to cherry-pick on maintenance branches to support grpc-java >= 1.54.0

@lhotari
Copy link
Member Author

lhotari commented Jun 21, 2023

In Pulsar we need Bookkeeper 4.16.2 release with this fix until we can make the switch to grpc-java 1.56 on Pulsar side. @zymap @hangc0276 @eolivelli @nicoloboschi @dlg99 Any timeline for 4.16.2 release?

@zymap
Copy link
Member

zymap commented Jun 22, 2023

@lhotari This PR is already included in the 4.16.2. I am preparing the release, and I think we can release it in the next week. But I met some failures in Pulsar's CI and need to take a look before sending the vote. It looks like something is wrong with the bookie that causes the pulsar's tests to fail.

@zymap
Copy link
Member

zymap commented Jun 22, 2023

It seems I met the same issue mentioned here protocolbuffers/protobuf#11986

Pulsar errors:

Caused by: java.lang.IllegalAccessError: class org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint and com.google.protobuf.LazyStringArrayList are in unnamed module of loader 'app')

@lhotari
Copy link
Member Author

lhotari commented Jun 22, 2023

It seems I met the same issue mentioned here protocolbuffers/protobuf#11986

Pulsar errors:

Caused by: java.lang.IllegalAccessError: class org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint and com.google.protobuf.LazyStringArrayList are in unnamed module of loader 'app')

@zymap I wonder what the resolution is? Perhaps there's an option to downgrade protobuf to 3.21.x ?

@lhotari
Copy link
Member Author

lhotari commented Jun 22, 2023

@zymap Perhaps setting protoc3.version and protoc-gen-grpc-java.version to some older version would help?
grpc/grpc-java#10202 (comment)

It seems to be designed that way that code gen should be generated with the oldest version of the supported library.

@lhotari
Copy link
Member Author

lhotari commented Jun 22, 2023

@zymap I made an attempt in #4000 to fix the issue.

@zymap
Copy link
Member

zymap commented Jun 25, 2023

It seems I met the same issue mentioned here protocolbuffers/protobuf#11986
Pulsar errors:
Caused by: java.lang.IllegalAccessError: class org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (org.apache.bookkeeper.proto.DataFormats$BookieServiceInfoFormat$Endpoint and com.google.protobuf.LazyStringArrayList are in unnamed module of loader 'app')

@zymap I wonder what the resolution is? Perhaps there's an option to downgrade protobuf to 3.21.x ?

@lhotari I found the reason for this error. It is caused by the protobuf-java version. In the generated code, it uses emptyList()

auth_ =
            com.google.protobuf.LazyStringArrayList.emptyList();
        extensions_ =
            com.google.protobuf.LazyStringArrayList.emptyList();

In the pulsar side, we are using 3.19.6, which the emptyList() method is package private https://github.com/protocolbuffers/protobuf/blob/5cba162a5d93f8df786d828621019e03e50edb4f/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java#L70

They have exposed the method to the public since 3.22.0 protocolbuffers/protobuf@c658e27

This means if we want to change upgrade protobuf to 3.22.0+, we must require all the sub-project, which depends on the bookkeeper to upgrade protobuf to 3.22.0+. It should not be acceptable in a minor release.

So I will exclude this PR from the 4.16.2 release and include it in the next major release.

Downgrade to 3.21.x seems everything will work well. And the CVE can be fixed by a lower version of grpc(1.54+), we can use an old grpc version.

zymap added a commit to zymap/bookkeeper that referenced this pull request Jun 25, 2023
---

### Motivation

We upgrade grpc and protobuf to address CVE-2023-32732.
But it requires the protobuf 3.22+. In protobuf 3.22.0,
it introduces a breaking change. It require all the
sub-project, which depends on the bookkeeper to upgrade
protobuf to 3.22.0+. It should not be acceptable in a minor
release.

So we use a lower version of grpc and protobuf to address
the CVE issue.

See more context: apache#3997
zymap added a commit that referenced this pull request Jun 26, 2023
…ng change (#4001)

* Downgrade grpc to 1.54.1
---

### Motivation

We upgrade grpc and protobuf to address CVE-2023-32732.
But it requires the protobuf 3.22+. In protobuf 3.22.0,
it introduces a breaking change. It require all the
sub-project, which depends on the bookkeeper to upgrade
protobuf to 3.22.0+. It should not be acceptable in a minor
release.

So we use a lower version of grpc and protobuf to address
the CVE issue.

See more context: #3997
zymap pushed a commit that referenced this pull request Dec 7, 2023
…me in the bookkeeper client. (#3997)

### Motivation

- grpc version was upgraded to 1.56.0 in #3992
- that breaks binary compatibility for DnsNameResolverProvider class
  - see grpc/grpc-java@fcb5c54#diff-b04e884de51ed12ff79482f600a2d4ec18e405ee189a4952ae35f4d2742b7160L50

### Changes

- make the field type NameResolverProvider instead of DnsNameResolverProvider
  - this prevents possible NoSuchMethodError errors about DnsNameResolverProvider.newNameResolver method

(cherry picked from commit ffc8e8b)
zymap added a commit that referenced this pull request Dec 7, 2023
…ng change (#4001)

* Downgrade grpc to 1.54.1
---

### Motivation

We upgrade grpc and protobuf to address CVE-2023-32732.
But it requires the protobuf 3.22+. In protobuf 3.22.0,
it introduces a breaking change. It require all the
sub-project, which depends on the bookkeeper to upgrade
protobuf to 3.22.0+. It should not be acceptable in a minor
release.

So we use a lower version of grpc and protobuf to address
the CVE issue.

See more context: #3997

(cherry picked from commit 9f63cf7)
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
…me in the bookkeeper client. (apache#3997)

### Motivation

- grpc version was upgraded to 1.56.0 in apache#3992
- that breaks binary compatibility for DnsNameResolverProvider class
  - see grpc/grpc-java@fcb5c54#diff-b04e884de51ed12ff79482f600a2d4ec18e405ee189a4952ae35f4d2742b7160L50

### Changes

- make the field type NameResolverProvider instead of DnsNameResolverProvider
  - this prevents possible NoSuchMethodError errors about DnsNameResolverProvider.newNameResolver method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants