RobertIndie opened a new pull request, #23929:
URL: https://github.com/apache/pulsar/pull/23929
### Motivation
When the producer's maximum count is reached, the broker will log the
following error message:
```
2025-02-05T18:31:37,996+0800 [pulsar-io-18-16] ERROR
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:57684] Failed to
create topic persistent://public/default/test2asgasgaw, producerId=1
java.util.concurrent.CompletionException:
org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException:
Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
at
java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368)
~[?:?]
at
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1189)
~[?:?]
at
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
~[?:?]
at
org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$34(ServerCnx.java:1586)
~[org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
at
java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:684)
[?:?]
at
java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662)
[?:?]
at
java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
[?:?]
at
org.apache.pulsar.broker.service.ServerCnx.handleProducer(ServerCnx.java:1539)
[org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
at
org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:209)
[org.apache.pulsar-pulsar-common-4.0.1.jar:4.0.1]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:202)
[io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:164)
[io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
[io.netty-netty-codec-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
[io.netty-netty-codec-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:152)
[io.netty-netty-handler-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
[io.netty-netty-transport-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
[io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[io.netty-netty-common-4.1.115.Final.jar:4.1.115.Final]
at java.base/java.lang.Thread.run(Thread.java:840) [?:?]
Caused by:
org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException:
Topic 'persistent://public/default/test2asgasgaw' reached max producers limit
at
org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$32(ServerCnx.java:1592)
~[org.apache.pulsar-pulsar-broker-4.0.1.jar:4.0.1]
at
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
~[?:?]
... 37 more
```
These errors are related to the client side. The client can handle the
error, so we don't need to print it in the broker log.
### Modifications
- Avoid printing the error log for the ProducerBusyException
### Verifying this change
After thsi PR, no error logs will be printed if the max producer for the
topic is reached:
```
2025-02-05T18:36:42,653+0800 [pulsar-io-16-20] WARN
org.apache.pulsar.broker.service.ServerCnx -
[PersistentTopic{topic=persistent://public/default/test123}] Attempting to add
producer to topic which reached max producers limit
2025-02-05T18:36:43,037+0800 [pulsar-io-16-20] INFO
org.apache.pulsar.broker.service.ServerCnx - Closed connection from
/127.0.0.1:59215
```
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions
will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since
the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed
in
a forked repository.
The tests will be run in the forked repository until all PR review comments
have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]