ambition119 commented on issue #4063: [pulsar-common] MaxMessageSize to user 
configuration
URL: https://github.com/apache/pulsar/pull/4063#issuecomment-484926498
 
 
   > `MaxMessageSize` should be agreed between client, broker and bookie. So a 
better approach would be:
   > 
   > 1. adding a setting `MaxMessageSize` setting to broker configuration.
   > 2. introduce a mechanism between client and broker to fetch some broker 
configurations when the client establishes a connection to broker. in this 
case, broker can return the MaxMessageSize it supports. so the client knows 
exactly the MaxMessageSize setting which it can use.
   > 
   > in any case, since we are changing a default value that is impacting 
end-users directly, a PIP is required.
   
   I simply think client and broker use PulsarDecoder.MaxFrameSize or 
PulsarDecoder.MaxMessageSize  config,like:
   ```java
   [client]
   if (payloadSize > PulsarDecoder.MaxMessageSize) 
   if (compressedSize > PulsarDecoder.MaxMessageSize) 
   [broker]
   new LengthFieldBasedFrameDecoder(PulsarDecoder.MaxFrameSize, 0, 4, 0, 4))
   ```
   
   I think bookie can through bookkeeper.conf  set nettyMaxFrameSizeBytes can 
resolve,but run java example found  it did not work,  occured exception :
   ```java
   [bookie-io-1-6] ERROR org.apache.bookkeeper.proto.BookieRequestHandler - 
Unhandled exception occurred in I/O thread or handler
   io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 
5242880: 32637007 - discarded
        at 
io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:522)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.LengthFieldBasedFrameDecoder.failIfNecessary(LengthFieldBasedFrameDecoder.java:500)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.LengthFieldBasedFrameDecoder.exceededFrameLength(LengthFieldBasedFrameDecoder.java:387)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:430)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:343)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
 ~[netty-codec-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648) 
[netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583)
 [netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500) 
[netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) 
[netty-transport-4.1.31.Final.jar:4.1.31.Final]
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
 [netty-all-4.1.32.Final.jar:4.1.32.Final]
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [netty-all-4.1.32.Final.jar:4.1.32.Final]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
   ```
   so nettyMaxFrameSizeBytes config to use Is the focus of the problem, tks.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to