GeezerVison is showing github.com — [improve][misc] Upgrade to Netty 4.1.111.Final and switch to use grpc-netty-shaded by lhotari · Pull Request #22892 · apache/pulsar
Conversation
lhotari
commented
Jun 11, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #22601
Fixes #21892
Fixes #19460
Motivation
Netty 4.1.111.Final contains important fixes:
These address Broker stability when TLS with Bookkeeper V2 protocol is used between Broker and Bookies.
This will also allow removing the extra buffer copies that have been in place in Pulsar broker and Pulsar client when TLS is enabled.
|
public static class CopyingEncoder extends ChannelOutboundHandlerAdapter { |
|
@Override |
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { |
|
if (msg instanceof ByteBufPair) { |
|
ByteBufPair b = (ByteBufPair) msg; |
|
|
|
// Some handlers in the pipeline will modify the bytebufs passed in to them (i.e. SslHandler). |
|
// For these handlers, we need to pass a copy of the buffers as the source buffers may be cached |
|
// for multiple requests. |
|
try { |
|
ctx.write(b.getFirst().copy(), ctx.voidPromise()); |
|
ctx.write(b.getSecond().copy(), promise); |
|
} finally { |
|
ReferenceCountUtil.safeRelease(b); |
|
} |
|
} else { |
|
ctx.write(msg, promise); |
|
} |
|
} |
|
} |
This will be removed in a separate PR.
Modifications
- Upgrade Netty to 4.1.111.Final version
Documentation
-
doc
-
doc-required
-
doc-not-needed
-
doc-complete
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
etcd tests break with Netty 4.1.111.Final. There's some compatibility issue.
I also tried upgrading jetcd to 0.8.2 and grpc to 1.64.0, but that didn't help.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lhotari
commented
Jun 12, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Unfortunately jetcd-core isn't compatible with grpc-netty-shaded. There are conflicts with io.grpc.netty.GrpcSslContexts/io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts and io.netty.handler.ssl.SslContext/io.grpc.netty.shaded.io.netty.handler.ssl.SslContext classes. The only solution seems to be to do custom shading for jetcd-core and jetcd-test.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I found a reasonable solution by shading jetcd-core in a way where vertx is relocated and included, but grpc is switched to use grpc-netty-shaded instead of grpc-netty. stream-storage-java-client supports switching to use grpc-netty-shaded without making changes to the module.
This resolves the issue with grpc-netty and Netty 4.1.111.Final.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lhotari
added a commit
that referenced
this pull request
Jun 13, 2024
…-netty-shaded (#22892)
(cherry picked from commit 75d7e55)
(cherry picked from commit a982d7b)
# Conflicts:
# distribution/server/pom.xml
lhotari
added a commit
that referenced
this pull request
Jun 13, 2024
- version in jetcd-core-shaded/pom.xml needs to match project version
This was referenced Jun 19, 2024
|
@lhotari Hi, I'm trying to deploy Pulsar v3.3.1 on K8s with etcd as metastore using the official Docker image, got an exception when executing bin/bookkeeper shell whatisinstanceid in pulsar-bookie-init job.
2024-09-11T16:10:48,297+0000 [main] INFO org.apache.bookkeeper.meta.MetadataDrivers - BookKeeper metadata driver manager initialized
2024-09-11T16:10:48,408+0000 [main] ERROR org.apache.bookkeeper.bookie.BookieShell - Got an exception
java.lang.NoClassDefFoundError: io/grpc/netty/shaded/io/grpc/netty/shaded/io/netty/handler/logging/ByteBufFormat
at org.apache.pulsar.jetcd.shaded.io.vertx.core.net.NetworkOptions.<clinit>(NetworkOptions.java:62) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at org.apache.pulsar.jetcd.shaded.io.vertx.core.VertxOptions.<init>(VertxOptions.java:143) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.vertx(ClientConnectionManager.java:223) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.defaultChannelBuilder(ClientConnectionManager.java:158) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.defaultChannelBuilder(ClientConnectionManager.java:149) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.getChannel(ClientConnectionManager.java:70) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.newStub(ClientConnectionManager.java:102) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.KVImpl.<init>(KVImpl.java:51) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientImpl.lambda$new$0(ClientImpl.java:48) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.support.MemorizingClientSupplier.get(MemorizingClientSupplier.java:37) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientImpl.getKVClient(ClientImpl.java:65) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at org.apache.pulsar.metadata.impl.EtcdMetadataStore.<init>(EtcdMetadataStore.java:111) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.EtcdMetadataStoreProvider.create(EtcdMetadataStore.java:515) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.newInstance(MetadataStoreFactoryImpl.java:63) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.createExtended(MetadataStoreFactoryImpl.java:50) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.api.extended.MetadataStoreExtended.create(MetadataStoreExtended.java:42) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.AbstractMetadataDriver.createMetadataStore(AbstractMetadataDriver.java:117) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.AbstractMetadataDriver.initialize(AbstractMetadataDriver.java:59) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.PulsarMetadataBookieDriver.initialize(PulsarMetadataBookieDriver.java:45) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.bookkeeper.meta.MetadataDrivers.runFunctionWithMetadataBookieDriver(MetadataDrivers.java:356) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.meta.MetadataDrivers.runFunctionWithRegistrationManager(MetadataDrivers.java:383) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.tools.cli.commands.bookies.InstanceIdCommand.apply(InstanceIdCommand.java:49) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell$WhatIsInstanceId.runCmd(BookieShell.java:1685) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell$MyCommand.runCmd(BookieShell.java:254) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell.run(BookieShell.java:2674) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell.main(BookieShell.java:2771) [org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
Caused by: java.lang.ClassNotFoundException: io.grpc.netty.shaded.io.grpc.netty.shaded.io.netty.handler.logging.ByteBufFormat
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) ~[?:?]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) ~[?:?]
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
... 26 more
It seems to me that this PR is related, any idea how to fix this? Thanks.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I tried 3.2.4, 3.0.6 and 3.0.5, only 3.0.5 works, and I noticed this commit isnt't on 3.3.1, so I guess I'll wait and try 4.0 when it's released.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@lhotari Hi, I'm trying to deploy Pulsar v3.3.1 on K8s with etcd as metastore using the official Docker image, got an exception when executing bin/bookkeeper shell whatisinstanceid in pulsar-bookie-init job.
2024-09-11T16:10:48,297+0000 [main] INFO org.apache.bookkeeper.meta.MetadataDrivers - BookKeeper metadata driver manager initialized
2024-09-11T16:10:48,408+0000 [main] ERROR org.apache.bookkeeper.bookie.BookieShell - Got an exception
java.lang.NoClassDefFoundError: io/grpc/netty/shaded/io/grpc/netty/shaded/io/netty/handler/logging/ByteBufFormat
at org.apache.pulsar.jetcd.shaded.io.vertx.core.net.NetworkOptions.<clinit>(NetworkOptions.java:62) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at org.apache.pulsar.jetcd.shaded.io.vertx.core.VertxOptions.<init>(VertxOptions.java:143) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.vertx(ClientConnectionManager.java:223) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.defaultChannelBuilder(ClientConnectionManager.java:158) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.defaultChannelBuilder(ClientConnectionManager.java:149) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.getChannel(ClientConnectionManager.java:70) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientConnectionManager.newStub(ClientConnectionManager.java:102) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.KVImpl.<init>(KVImpl.java:51) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientImpl.lambda$new$0(ClientImpl.java:48) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.support.MemorizingClientSupplier.get(MemorizingClientSupplier.java:37) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at io.etcd.jetcd.impl.ClientImpl.getKVClient(ClientImpl.java:65) ~[org.apache.pulsar-jetcd-core-shaded-3.3.1-shaded.jar:3.3.1]
at org.apache.pulsar.metadata.impl.EtcdMetadataStore.<init>(EtcdMetadataStore.java:111) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.EtcdMetadataStoreProvider.create(EtcdMetadataStore.java:515) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.newInstance(MetadataStoreFactoryImpl.java:63) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.createExtended(MetadataStoreFactoryImpl.java:50) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.api.extended.MetadataStoreExtended.create(MetadataStoreExtended.java:42) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.AbstractMetadataDriver.createMetadataStore(AbstractMetadataDriver.java:117) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.AbstractMetadataDriver.initialize(AbstractMetadataDriver.java:59) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.pulsar.metadata.bookkeeper.PulsarMetadataBookieDriver.initialize(PulsarMetadataBookieDriver.java:45) ~[org.apache.pulsar-pulsar-metadata-3.3.1.jar:3.3.1]
at org.apache.bookkeeper.meta.MetadataDrivers.runFunctionWithMetadataBookieDriver(MetadataDrivers.java:356) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.meta.MetadataDrivers.runFunctionWithRegistrationManager(MetadataDrivers.java:383) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.tools.cli.commands.bookies.InstanceIdCommand.apply(InstanceIdCommand.java:49) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell$WhatIsInstanceId.runCmd(BookieShell.java:1685) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell$MyCommand.runCmd(BookieShell.java:254) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell.run(BookieShell.java:2674) ~[org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
at org.apache.bookkeeper.bookie.BookieShell.main(BookieShell.java:2771) [org.apache.bookkeeper-bookkeeper-server-4.17.1.jar:4.17.1]
Caused by: java.lang.ClassNotFoundException: io.grpc.netty.shaded.io.grpc.netty.shaded.io.netty.handler.logging.ByteBufFormat
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) ~[?:?]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) ~[?:?]
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
... 26 more
It seems to me that this PR is related, any idea how to fix this? Thanks.
@inetfuture Please report a separate GH issue with steps to reproduce. That will be helpful in addressing this problem.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 15, 2024
|
|
import io.grpc.netty.GrpcSslContexts;
|
|
|
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
|
|
|
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext;
|
|
|
import io.grpc.netty.shaded.io.netty.handler.ssl.SslProvider;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhotari
The method definition of io.etcd.jetcd.ClientBuilder.sslContext is below
public ClientBuilder sslContext(io.netty.handler.ssl.SslContext sslContext) {
this.sslContext = sslContext;
return this;
}
But you changed the import item io.netty.handler.ssl.SslContext to ...shade..., how can it compile successfully? And the branch-3.0 can not be compiled successfully too
cc @tjiuming @Technoboy-
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poorbarcode shading problems were addressed with #23604 and #23641. You might have to compile all projects on command line with mvn -T 1C clean install -DskipTests -Dspotbugs.skip=true -Dcheckstyle.skip=true -Dlicense.skip=true before running code in IntelliJ/IDEA.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
nodece
pushed a commit
to nodece/pulsar
that referenced
this pull request
Jun 3, 2025
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|